RubyOnRails Route Generation Awesomeness

Before I decided to leave work, I wanted to get this photo album system started. It’s polymorphic and allows users, videos, etc, to all have albums. I wanted to use a single controller, views, etc. Well, I never knew that you could do the following:

1
<%= link_to 'Back', [:admin, @parent, :albums] %>

Assuming @parent is the parent object owning the album, it will generate a link to /admin/videos/5/albums

How awesome is that.

Related posts:

  1. Polymorphic Associations For Tools Like You
  2. SearchLogic Just Seems … Logical …
  3. Paperclip Resized Image Details In to_xml
  4. Inherited_resources is as close to GOD as you can get
  5. Inherited_resources fondles swfupload and you didn’t even know it
blog comments powered by Disqus