Skip to content
This repository has been archived by the owner on May 8, 2022. It is now read-only.

form helper does not work with Rails 3.0.7 #3

Open
pcg79 opened this issue May 4, 2011 · 2 comments
Open

form helper does not work with Rails 3.0.7 #3

pcg79 opened this issue May 4, 2011 · 2 comments

Comments

@pcg79
Copy link

pcg79 commented May 4, 2011

I don't know at what point the form helper stopped working so I'm just going to say it doesn't work on 3.0.7 as that's the version I'm running on.

I have a nested model (although I tried this with a non-nested model and got the same problem) called Employer::Question. I created a haml form for the new view and called:

= form('question')

Reloading the page threw the error that Rails couldn't find the route :action => "employer/questions", :controller => "employer/questions".

I dug into the code some and it looks like the form method is expecting url_for to return the action name ("create" for example). But it's actually returning the path for the action ("employer/questions" in my case).

Changing the call to form_for to:

contents = form_tag(action, :method =>(options[:method] || 'post'), :enctype => options[:multipart] ? 'multipart/form-data': nil)

seems to fix the problem but all the tests break because the overridden url_for still returns the action. I don't know how to fix the tests so I haven't sent a pull request. I'm sorry for that.

@pehrlich
Copy link

pehrlich commented Aug 2, 2011

experiencing the same issue on rails 3.1rc4. Thanks for the writeup..!

@srinathy
Copy link

can you tell me,is it working now in rails3.1 ?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants