Mat Schaffer on 6 Mar 2008 20:15:58 -0800


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Mixin's vs inheritance (was Re: [PhillyOnRails] refactoring controllers)

  • From: Mat Schaffer <schapht@gmail.com>
  • To: talk@phillyonrails.org
  • Subject: Mixin's vs inheritance (was Re: [PhillyOnRails] refactoring controllers)
  • Date: Thu, 6 Mar 2008 23:15:41 -0500
  • Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:from:to:in-reply-to:content-type:content-transfer-encoding:mime-version:subject:date:references:x-mailer; bh=y/+zB8LS+mPOp8Mm6kApHvqzL3gA3pGina1Yp3Cv2GM=; b=bYZ3IfjtL3b0tNdbigJDfQ5VTHiqGqbWLsbdUuy3JKJbhJldzblT+ZGr0UOK/K9YlOnUCe6FEuoPb35ewORGOrGxLfOv7e4My2ij7fwN6naHcQr1RmHVcdg30QUVT3hviEH+44+qGObVk8HxKcMqT+zTThPTeBx5rFAz9Yosds8=
  • List-archive: <http://lists.phillyonrails.org/pipermail/talk>
  • Reply-to: talk@phillyonrails.org
  • Sender: talk-bounces@phillyonrails.org

On Mar 6, 2008, at 9:03 PM, Colin A. Bartlett wrote:
On Mar 6, 2008, at 7:46 PM, Aaron Blohowiak wrote:
put the common code in a module that you then include in both controllers. this lets your controllers share code without having to do any redirects or what have you from the client perspective.

Or make a class that your controllers can inherit from.

Sounds like East coast vs West Coast to me.  :)

But on that note, I was watching the Railscast about make_resourceful today and couldn't help but wonder why it was written as mix-in meta magic rather than just a RestfulController class. Mixin's are rockin and all, but anyone get the feeling inheritance is getting the short end of the stick in rails pop culture?

Oh, and Chris, you shouldn't have to restart rails every time you change a model. Something's wrong. Not sure what though.

And as for "it feels wrong" people in the rails camp tend to agree that a fat model is very right:
http://slash7.com/assets/2007/2/12/layercake.png

(can't find the original article on this one)

-Mat
_______________________________________________
To unsubscribe or change your settings, visit:
http://lists.phillyonrails.org/mailman/listinfo/talk