Hi, Rails and/or Firefox are driving me nuts. I have a products_controllers with 2 actions: index and show. - On the index action a session is set to create an order if user has no order yet. - On that index page, user can click on a link that will bring him to the show action of a product where payment buttons are displayed. - The show action is protected by a before_filter login_required, and a before filter for checking if a session[:order_id] is present, if not he goes to index action. - After logging in, user is redirected to show action, payment buttons appear, and his session[:order_id] is set to nil. All is fine up to here. So now while on show action, if user hits the reload button, as his session is empty, he will go to index page. That works. But now, hang on tight, back on index page, if user click the refresh button, for some mysterious reason, he goes to the show page he previously visited!!! How is that possible??? And even more strange, while on the index page, if user hits enter key in the address bar, then the user doesn''t get redirected to show page, but stays on index page!? Is that a buggy behavior from Firefox or what??? -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
> Is that a buggy behavior from Firefox or what???Damn! It''s Firefox going nuts! I tested with Safari and I don''t have that problem... Grrr that''s very bad! -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 Apr 4, 3:50 pm, Fernando Perez <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> But now, hang on tight, back on index page, if user click the refresh > button, for some mysterious reason, he goes to the show page he > previously visited!!! How is that possible???> > And even more strange, while on the index page, if user hits enter key > in the address bar, then the user doesn''t get redirected to show page, > but stays on index page!? > > Is that a buggy behavior from Firefox or what???Without going into the specifics of what you have or have not done, I think you might need to do a little more digging: is firefox requesting the wrong page from your app, is it requesting the right page but doing something funny, is it just serving a page from its cache ? 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
> Without going into the specifics of what you have or have not done, I > think you might need to do a little more digging: is firefox > requesting the wrong page from your app, is it requesting the right > page but doing something funny, is it just serving a page from its > cache ? > > FredFirefox requests the page that was protected by the before_filter. Safari doesn''t do that. It''s only when I use the refresh button (or ctrl+r shortcut) that firefox instead of refreshing the current index page, goes to the former /show/my_url. If I "refresh" manually the index page by simply pressing the Enter key when focus is in the address bar, it doesn''t act stupidly. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Phillip wrote:> This could be handy: > > <table style = "font-size:small;"> > <% req = request.env > req.each do |key,value| %> > <tr><td><%= "#{key}" %></td><td><%= "#{value}" %></td></tr> > <% end %> > </table>Interesting idea, however I couldn''t find any data concerning the redirection to the show page. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 4 апр, 18:50, Fernando Perez <rails-mailing-l...@andreas-s.net> wrote:> Hi, > > Rails and/or Firefox are driving me nuts. > > I have a products_controllers with 2 actions: index and show. > > - On the index action a session is set to create an order if user has no > order yet. > - On that index page, user can click on a link that will bring him to > the show action of a product where payment buttons are displayed. > - The show action is protected by a before_filter login_required, and a > before filter for checking if a session[:order_id] is present, if not he > goes to index action. > - After logging in, user is redirected to show action, payment buttons > appear, and his session[:order_id] is set to nil. > > All is fine up to here. So now while on show action, if user hits the > reload button, as his session is empty, he will go to index page. That > works. > > But now, hang on tight, back on index page, if user click the refresh > button, for some mysterious reason, he goes to the show page he > previously visited!!! How is that possible??? > > And even more strange, while on the index page, if user hits enter key > in the address bar, then the user doesn''t get redirected to show page, > but stays on index page!? > > Is that a buggy behavior from Firefox or what??? > -- > Posted viahttp://www.ruby-forum.com/.Did you used redirect_to or just called one action from another? First approach should be used. --~--~---------~--~----~------------~-------~--~----~ 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
> Did you used redirect_to or just called one action from another? > First approach should be used.At which step? On index page, user clicks on a link like: mysite.com/products/product-1 products_controller/show is protected by a before_filter which redirect_to a signup/login page (using restful_auth). When user is identified, redirect_back_or_default(''/'') will redirect the user to mysite.com/products/product-1 and clear session[:return_to] On the show page, if user hits the reload button, a redirect_to will bring him back to the index. Now here is the split between Firefox and Safari: - on index page, with Firefox, if user hits refresh button, he goes back to /products/product-1, that''s incorrect behavior. - on index page, with Safari, if user hits refresh button, the index page gets refreshed. That''s the expected behavior. So whose fault is it? Rails or Firefox? Can you please be more accurate? I don''t see at which step I should be using a redirect_to instead of a call, as I already use redirections where they are required (I think). Best regards, -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---