![]() | Question about Iteration D2, on the 4th edition of the book |
|
22 Feb 2012, 18:33
Daniel Freire (3 posts) |
Hey guys, I was the code written at page 108, and there was a method called “ensure_not_referenced_by_any_line_item”. The first line inside the method is that: “if line_items.empty?”. My question is: Where the attribute “line_items” is declared? What does he holds? Thank you! ( My english is very bad, sorry. =P ) |
|
22 Feb 2012, 18:34
Daniel Freire (3 posts) |
class Product < ActiveRecord::Base has_many :line_items
|
|
25 Feb 2012, 02:00
Sam Ruby (549 posts) |
The Line is created in section D2. The “has_many :line_items” in the code you posted above has the effect of declaring an attribute which holds a collection of LineItem records. Similarly, the line “belongs_to :product” in the LitemItem class has the effect of declaring an attribute that contains a reference to a single Product. |
|
04 Mar 2013, 00:39
Martin Miranda (3 posts) |
Hello, I’ve got the following error when running functional test:
Any idea? |
| You must be logged in to comment |

