Revolution On Rails: DRYing Up Polymorphic Controllers:

Revolution On Rails: DRYing Up Polymorphic Controllers:

Polymorphic routes allow drying up the controller implementation when functionality is identical, regardless of entry point. A good example is comments for articles and blogs. There is a challenge to balance the implementation of the comments controller reflecting the multiple incoming routes. Let's look at the way it could be written. Routing is straightforward with blogs and article models acting as commentable and both the comment model and comment controllers being polymorphic:

Full article: http://revolutiononrails.blogspot.com/2007/05/drying-up-p...

Tweets

The Bulletin: Sustainable Fashion: An Industry ...

sustainable-fashion.com 06 Mar '12, 12pm

National Chamber for Italian Fashion are hosting a seminar to study aspects that are driving change in the environmental a...

Railscasts - Polymorphic Association:

railscasts.com 09 Mar '12, 10pm

class Comment < ActiveRecord::Base belongs_to :commentable, :polymorphic => true end class Article < ActiveRecord::Base ha...

Super excited about , which just landed on Rail...

edgeguides.rubyonrails.org 05 Mar '12, 12pm

Resourceful Routing: If you’re building a RESTful JSON API , you want to be using the Rails router. Clean and conventional...

ASCIIcasts - “Episode 224 - Controllers in Rail...

asciicasts.com 13 Mar '12, 8pm

This line is added by default in a new Rails 3 application. It’s easy to forget to add filtering into an application so it...

Wizard-ify Your Rails Controllers with Wicked

rubyflow.com 28 Feb '12, 4pm

Wizard-ify Your Rails Controllers with Wicked Posted by schneems on February 28, 2012 — 0 comments Use Wicked to turn any ...

Haml and Rails

rubyflow.com 09 Mar '12, 1am

with some helpful suggestions from Brook Riggio's blog post on Haml by Default in a New Rails 3.2 App . The RailsApps appl...