Partial form with nested routes
- by jerhinesmith
I have two models -- User and Entry -- that are related through a has_many relationship (a User has many Entries). I'm using RESTful routing, and have the following in my routes.rb file:
map.resource :user, :controller => "users" do |user|
user.resources :entries
end
This seems to work, but in my partial _form file, when I do this:
form_for [@current_user, @entry] do |f|
# Form stuff
end
It generates a URL like this:
/user/entries.%23%3Cuser:0xb6a6aea8%3E
instead of
/user/entries
Am I missing something?
I should note that the correct classes are applied to the form when doing creation vs. editing, so it does seem to be correctly interpreting what I'm trying to do -- it's just that I can't submit the form to an invalid url.