What''s the best way to do a javascript alert warning when someone is trying to access a ajax method that requires authentication - for example to rate a recipe, I have a star-based ajax/css interface. To actually add a rating you need to be logged in. When I use the before_filter, it just redirects to the login page - I''d like to show an alert that says something like "to add a rating, please register/ login first" right there - what''s the best way to do this? --~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On 5 Nov 2007, at 17:41, raghus wrote:> > What''s the best way to do a javascript alert warning when someone is > trying to access a ajax method that requires authentication - for > example to rate a recipe, I have a star-based ajax/css interface. To > actually add a rating you need to be logged in. When I use the > before_filter, it just redirects to the login page - I''d like to show > an alert that says something like "to add a rating, please register/ > login first" right there - what''s the best way to do this?Your before_filter stuff is just regular code. It can do a render :update for example just as easily as it does a redirect. Fred --~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
That was a helpful answer - thanks Fred. On Nov 5, 9:49 am, Frederick Cheung <frederick.che...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On 5 Nov 2007, at 17:41, raghus wrote: > > > > > What''s the best way to do a javascript alert warning when someone is > > trying to access a ajax method that requires authentication - for > > example to rate a recipe, I have a star-based ajax/css interface. To > > actually add a rating you need to be logged in. When I use the > > before_filter, it just redirects to the login page - I''d like to show > > an alert that says something like "to add a rating, please register/ > > login first" right there - what''s the best way to do this? > > Your before_filter stuff is just regular code. It can do a > render :update for example just as easily as it does a redirect. > > Fred--~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---