Rails form helper and RESTful routes
Posted
by Jimmy
on Stack Overflow
See other posts from Stack Overflow
or by Jimmy
Published on 2010-06-03T02:17:39Z
Indexed on
2010/06/03
2:24 UTC
Read the original article
Hit count: 267
Hey guys,
I have a form partial current setup like this to make new blog posts
<% form_for([@current_user, @post]) do |f| %>
This works great when editing a post, but when creating a new post I get the following error:
undefined method `user_posts_path' for #<ActionView::Base:0x6158104>
My routes are setup as follows:
map.resources :user do |user|
user.resources :post
end
Is there a better way to setup my partial to handle both new posts and editing current posts?
© Stack Overflow or respective owner