Chris Cera on 6 Mar 2008 21:14:50 -0800


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

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


My original problem was the reloading of the model, and I was
mistakenly trying to work around it in evil ways.  Thanks
everyone for the suggestions.

This is what I needed b/c I'm on an ancient version of rails,
where classes that aren't part of ActiveRecord, in model where I
had some of this logic, do not get reloaded.  It was patched
awhile ago (i know i know).

    # Workaround -- web/app/model/blah.rb:
    class Blah
      include Reloadable 
    end

Thanks Mat for pointing out the fat-model approach ... and the
graphic :)  I just did a bunch of useful reading on fat-model,
but make sure you add the word "rails" when you use google ;)

Thanks for the help, -Chris



* Mat Schaffer <schapht@gmail.com> [080306 23:19]:
> 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

-- 
Christopher D. Cera, CTO
http://vuzit.com
P: 215.435.2289
F: 267.295.7369
_______________________________________________
To unsubscribe or change your settings, visit:
http://lists.phillyonrails.org/mailman/listinfo/talk