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

form helper does not work with Rails 3.0.7 #3

@pcg79

Description

@pcg79

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions