Hello, I''m having a strange routing problem. When I try to post my form, apache rederects me to the wrong action (index). This is my form tag: <% form_tag(assets_url,:multipart => true ,:id=>"fileform",:method=>:post) do %> On my local machine (webbrick) , it redirects me correctly to the create action in my assets controller. When I post this form on my apache server, I''m redirected to the index action. So I ended up with creating this tag: <% form_tag(createnew_assets_url,:multipart => true ,:id=>"fileform",:method=>:post) do %> I added a createnew method in my assets controller + I fixed the new route. This is a very bad solution but I don''t understand why apache is redirecting me to the wrong url. Any suggestions? -- 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 8/11/07, Maarten Porters <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > Hello, > > I''m having a strange routing problem. When I try to post my form, apache > rederects me to the wrong action (index). > > This is my form tag: > > <% form_tag(assets_url,:multipart => true > ,:id=>"fileform",:method=>:post) do %> > > On my local machine (webbrick) , it redirects me correctly to the create > action in my assets controller. When I post this form on my apache > server, I''m redirected to the index action. So I ended up with creating > this tag: > > <% form_tag(createnew_assets_url,:multipart => true > ,:id=>"fileform",:method=>:post) do %> > > I added a createnew method in my assets controller + I fixed the new > route. > > This is a very bad solution but I don''t understand why apache is > redirecting me to the wrong url. Any suggestions?Are you using page caching? Perhaps it sees that you have /foo/index.html so redirects POST /foo to GET /foo/. Try this: http://mephisto.stikipad.com/help/show/Developer+Tips -- Rick Olson http://lighthouseapp.com http://weblog.techno-weenie.net http://mephistoblog.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 -~----------~----~----~----~------~----~------~--~---
> > Are you using page caching? Perhaps it sees that you have > /foo/index.html so redirects POST /foo to GET /foo/. >Hi Rick, I''m not using page caching at all. My form is just doing a GET request for assets_path, instead of a POST. Could this be a rails bug? -- 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 -~----------~----~----~----~------~----~------~--~---
I found out the cause of this routing problem. Actually it is related to Rick''s attachment_fu plugin. I''m using the model "asset" which uses the plugin. By default, all assets are saved in public/assets . This causes some routing conflicts with the controller routes. I fixed it by changing the location of uploaded files. So my asset model looks like this: class Asset < ActiveRecord::Base has_attachment :content_type => :image, :storage => :file_system, :path_prefix => ''public/uploads'', :max_size => 1.megabytes, :resize_to => ''640x>'', :thumbnails => { :thumb => ''80x>'', :medium => ''125x>'',:large=> ''190x'' },:processor => :Rmagick Maby you should mention this in the readme of attachment_fu. It took me a while to find the solution. -- 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 -~----------~----~----~----~------~----~------~--~---