Rails: Law of Demeter Confusion
- by user2158382
I am reading a book called Rails AntiPatterns and they talk about using delegation to to avoid breaking the Law of Demeter. Here is their prime example:
They believe that calling something like this in the controller is bad (and I agree)
@street = @invoice.customer.address.street
Their proposed solution is to do the following:
class Customer
…