I hav开发者_如何学JAVAe a link that is generated from an array of objects...
<%= link_to 'Add a Post', [@object, Post.new], :action => 'new', :remote => true, :class => 'button gray medium' %>
however this only generates '/businesses/12/posts/' while I would like to have a '/new' at the end of it, therefore '/businesses/12/posts/new'. Is this possible with link_to array of objects? The :action => 'new' appears to do nothing in the case above.
The @object could be various types of objects so I can't use the new_business_post_path(). And each of these objects will have a resourceful route to posts
The answer is to use:
[:new, @object, :post]
Which translates to:
new_businesses_post()
精彩评论