If you name a route, you can name it beautifully:
match 'comments/new(/:post_id/(/:parent_id))' => 'comments#new', :as => :new_comment
You can call it either with an options hash or an array in the correct order:
link_to "New Comment", new_comment_path(:post_id => 1, :parent_id => 2)
link_to "New Comment", new_comment_path(1, 2)
source
share