[Rails] Re: Rails Routes/Controller/Directory Structure design question
How do you deal with form_for's when the routes are nested?
For example, let's say you have a Admin::CompaniesController in
your :admin namespace. The model is obviously Company. I get an error
for new forms:
<%= simple_form_for(@company, :url =>
admin_company_path(@company)) do |f| %>
Here's the error message:
ActionView::Template::Error: No route matches
{:action=>"show", :controller=>"admin/companies", :id=>#<Company id:
nil, name: nil, phone_number: nil, address: nil, postal_code: nil,
is_enabled: true, courses_created: 0, province_id: nil, theme_id: nil,
payment_plan_id: nil, created_at: nil, updated_at: nil>}
How can I get rails to play nice? I have no idea why it's even trying
to use the show action at all...
--
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@googlegroups.com.
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.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home