Hi,

Let's take the example of the depot app. In my controller I set @order.
Then in the view comes the bad stuff:

@order.items.each do |item|
  item.product.title
end

Now I'm having problems specing item.product.title. A quick and dirty
fix is to trade a for for an underscore, so I create Item#product_title:

def product_title
  product.title
end

The problem is that I have a few models that act the same way, so I
would find myself writing lot's of these little instance methods, and
the solution looks a bit stupid to me. So how do you handle such issue?

I thought about composed_of, but AWDWR's examples still break Demeter's
law and that annoys me.


Thanks in advance
-- 
Posted via http://www.ruby-forum.com/.
_______________________________________________
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users

Reply via email to