Just a quick tip, this one!

If you have a model that is polymorphic, say a comment model:

class Comment
  belongs_to :user
  belongs_to :commentable, :polymorphic => true
end

and you want to link to the item the comment relates to in the admin system, you can do this:

<%= link_to comment.commentable.title, [:admin, comment.commentable] %>

Note this assumes all of your commentable models have a title attribute or method, and that you have used normal RESTful routes. The :admin symbol will namespace the link to /admin

Post a Comment

*
*