Valery Kvon wrote in post #1047990:
> On 21.02.2012, at 14:08, ruby LED wrote:
>
>>   end
>> end
>>
>
> So.
>
> I agree that:
> 1) current_item = LineItem.new(:product_id=>product_id) = BAD IDEA.
> Because, if you pass the invalid product ID, LineItem would be
> initialized as well, but the .product association would return nil.
do you think current_item = line_items.build(:product_id => product_id) 
is better?
> 2) Actually I didn't see how quantity is set up? Looking at your
> previous code it must be method 'quantity'.
 i dont have a method quantity
> PS. Why are you writing product.price=?
i belive it is same with product.price * quantity
to show the sum of all products inside my cart

-- 
Posted via http://www.ruby-forum.com/.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to