On Fri, Apr 24, 2009 at 5:12 PM, Rémi Gagnon
<[email protected]> wrote:
>
> Hello,
>
> I'm looking for a recipe to handle session logged out or expired in an
> ajax calls.  For instance, lets say we have a form submission in ajax
> that the user needs to be authenticated to perform this action.  I'd
> like to at least notice the user that he is not logged in anymore or
> even better prompt an authentication form.
>
> Any suggestions?
>
> Rémi

Just return the relevant information from your Ajax call

If you're using RJS, you could do

render :update do |page|
  if authenticated?
    page.redirect_to login_path
  else
    page.alert("You're authenticated")
  end
end

Andrew Timberlake
http://ramblingsonrails.com
http://www.linkedin.com/in/andrewtimberlake

"I have never let my schooling interfere with my education" - Mark Twain

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to