Stephen Kilbourn
2010-Jun-07 04:37 UTC
authenticity_token shows up in the url when page reloads
I''m pretty new to Ruby On Rails (and somewhat self-taught), so bear with me if I''m asking something stupid. So whenever I push my download button (which just uses send_file, if that''s any help) it reloads the page, without downloading, and it puts the authenticity_token in the url. This all the button is: <% form_remote_tag :url => { :action => ''download''} do %> <%= submit_tag "Download" %> <% end %> Basically, it''s just not working at all, and I would appreciate any sort of help with the issue. Thanks in advance. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Peter De Berdt
2010-Jun-07 08:09 UTC
Re: authenticity_token shows up in the url when page reloads
On 07 Jun 2010, at 06:37, Stephen Kilbourn wrote:> I''m pretty new to Ruby On Rails (and somewhat self-taught), so bear > with > me if I''m asking something stupid. So whenever I push my download > button > (which just uses send_file, if that''s any help) it reloads the page, > without downloading, and it puts the authenticity_token in the url. > This > all the button is: > <% form_remote_tag :url => { :action => ''download''} do %> > <%= submit_tag "Download" %> > <% end %> > > Basically, it''s just not working at all, and I would appreciate any > sort > of help with the issue. Thanks in advance.Downloading a file is a "full page refresh" (although the page won''t actually refresh). You shouldn''t use an AJAX function (whether that''s a link or a form) to send a file to the client. Just serve it up with the right content type as a normal request and you''ll be fine. Best regards Peter De Berdt -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Stephen Kilbourn
2010-Jun-09 00:52 UTC
Re: authenticity_token shows up in the url when page reloads
Peter De Berdt wrote:> Downloading a file is a "full page refresh" (although the page won''t > actually refresh). You shouldn''t use an AJAX function (whether that''s > a link or a form) to send a file to the client. Just serve it up with > the right content type as a normal request and you''ll be fine.I get what you''re saying and I''ve tried a few different methods. But alas, I am a beginner and have not gotten anything to work. Would you maybe happen to have any specific ideas as to how I could remedy my solution. Thanks again for your help. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Stephen Kilbourn
2010-Jun-09 02:21 UTC
Re: authenticity_token shows up in the url when page reloads
Nevermind, I got it... Still couldn''t have gotten it without your help. Thanks. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.