When you define a has_many relation, you automatically get the methods to query those objects. In this case, the method order. Items So you can do: Order.
Find_each do |order| puts "Order #{order. Id}:" order.items. Each do |item| puts "Item #{item.Id}" end end (I used find_each method, which is available from Rails 2.3+.
You could use a simple Order.all. Each though.
When you define a has_many relation, you automatically get the methods to query those objects. In this case, the method order.items" rel="nofollow">order.items. So you can do: Order.
Find_each do |order| puts "Order #{order. Id}:" order.items" rel="nofollow">order.items. Each do |item| puts "Item #{item.Id}" end end (I used find_each method, which is available from Rails 2.3+.
You could use a simple Order.all. Each though.
Excellent, thanks! But if I want to use it in a template, it won't work, right? It says undefined method 'items'.
– Arty Jul 4 '10 at 20:14 It should work, assuming you are correctly calling on an object of type Order. How exactly are you calling it in your view? – Chubas Jul 4 '10 at 20:22 – Arty Jul 4 '10 at 20:28 Ok, I got it.It works.
Should have been 'item' not 'items'. Thanks a lot! – Arty Jul 4 '10 at 20:30.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.