Created
June 4, 2012 17:45
-
-
Save jackdempsey/2869781 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
= form_for @list do |f| | |
no routes matches /lists | |
= form_for @list, url: (@list.new_record? ? lists.lists_path : lists.list_path(@list) do |f| |
You can use form_for [list, @list]
: https://github.com/rails/rails/blob/master/railties/lib/rails/engine.rb#L281-289
err, form_for [lists, @list]
(the first array element is helper for mounted routes)
Awesome, the one thing I didn't try. Makes sense. TY sir!
No problem :)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If I use the bottom line, things seem to work and point to the right urls in the isolated lists engine, mounted at /lists.
Within the engine I can use form_for @list just fine. Just wondering if there's a way to avoid url hackery like above when pointed at some routes/actions within the engine.