Nepal on Rails

millisami's rants!

Rails3 Singleton Resource With Form_for Gotcha

Dealing with the singleton resource was quite a bit tricky:

# config/routes.rb
resource :passion

# form.html.slim
= form_for @passion do |f|

Throws an error:

undefined method `passions_path for #<#<Class:0x0000012d957008>:0x000001347f1ae0>`

So the fix is:

= form_for @passion, url: passion_path do |f|