[rspec-users] RSpecers point of view about how to create rails association

Fernando Perez lists at ruby-forum.com
Sat May 2 16:42:35 EDT 2009


> You *could*  write wrapper methods for chains like this and make Demeter
> happy, but to do that for every single call...

Thank you for your experience. I myself used to wrap these kind of 
associations but I felt it started to clutter the Model file, so I 
started to use association callbacks.

My heart balances between both ideas. Anyway if attr_accessible is used, 
then you must write a wrapper, but in other cases? Which is the most 
effective / maintainable / etc is still to be questioned.

Honestly, each time something backfired at me in a very unexpected 
manner, it was due to the fact that somewhere far far away I had broken 
Demeter's law. So I'd like to get this fixed once and for all.
-- 
Posted via http://www.ruby-forum.com/.


More information about the rspec-users mailing list