On Wed, Oct 1, 2008 at 7:54 AM, Ashley Moran <[EMAIL PROTECTED]> wrote: > Hi > > The discussion among me, David, Michael, and Pat got me thinking. > Specifically this by Michael: > >> Just my $0.02, but I really like specs to be treated as specifications for >> what SHOULD be happening, not pretending other code is different than it is. > > This made me think the real solution is for ActiveRecord/A N Other ORM to > declare that its associations are proxies and not arrays. But that's > *terrible*, because it's encouraging users to manipulate the ORM objects' > structures. > > So what if you flatly make all associations private? Is this a good idea? > Has anyone tried it?
It's been a while since I've taken a look at it, but Luke Redpath has a plugin called Demeter's Revenge (http://plugins.code.lukeredpath.co.uk/browser/demeters_revenge/trunk) that actually manages this all for you by adding methods like team.add_player that wrap chains like team.players.add. It's a year old and I don't know if it works w/ the latest rails updates or not. I think that if you're actually writing a bunch of boilerplate code the same way over and over without a plugin like that, then it's probably painful. With something like that it's painless and expressive and seriously cleans up your controller code examples. Glancing at github, I see one other library up there that tries to solve the same problem. Will have to look closer later at http://github.com/trotter/belongs_to_demeter. Cheers, David > > Ashley > > -- > http://www.patchspace.co.uk/ > http://aviewfromafar.net/ > > > > _______________________________________________ > rspec-users mailing list > rspec-users@rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users > _______________________________________________ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users