Skip to content

Instantly share code, notes, and snippets.

@jackdempsey
Created June 4, 2012 17:45
Show Gist options
  • Save jackdempsey/2869781 to your computer and use it in GitHub Desktop.
Save jackdempsey/2869781 to your computer and use it in GitHub Desktop.
= 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|
@jackdempsey
Copy link
Author

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.

@drogus
Copy link

drogus commented Jun 4, 2012

@drogus
Copy link

drogus commented Jun 4, 2012

err, form_for [lists, @list] (the first array element is helper for mounted routes)

@jackdempsey
Copy link
Author

Awesome, the one thing I didn't try. Makes sense. TY sir!

@drogus
Copy link

drogus commented Jun 4, 2012

No problem :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment