Forum: Ruby on Rails form_for problem with singular resource

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
4c70286747864c04c5c1f9b0aa380590?d=identicon&s=25 Joe Blow (joeblow)
on 2008-11-15 23:32
Can you use polymorphic urls with form_for when you have a singular
resource?

In routes.rb
  map.resource :blog

In BlogsController
  def new
     @blog = Blog.new
  end

In new.html.erb
  <% form_for @blog do |f| %>
  ....
  <% end %>

But the view is giving me the following error.

undefined method `blogs_path' for #<ActionView::Base:0xb691281c>

I do not know why @blog is converting into blogs_path. Shouldn't it be
converted to create_blog_path since @blog is a new record? If it was an
existing record I would assume it would go to update_blog_path or
something.

Can someone please explain what I am doing wrong.
This topic is locked and can not be replied to.