Flowdock

Notes posted by danwich

RSS feed
January 16, 2012
0 thanks

form_for with :as routing

The following will not work if your post model is routed with the :as option:

form_for(@post)

Instead, use the helper with your custom name:

form_for(@post, :url => edit_renamedpost_path(@post))
January 16, 2012
1 thank

Model objects routed with :as

When providing a model object, url_for will not work if the model’s routes are named using the :as option. You can instead use the named helper methods (posts_path, post_path(:id), etc.).