On Tue, Feb 21, 2012 at 10:55 AM, ruby LED <[email protected]> wrote:

> Colin Law wrote in post #1047978:
> > On 21 February 2012 09:39, ruby LED <[email protected]> wrote:
> >>
> >> it feels like im adding a nil value at my first attemp of adding a
> >> product into my cart?
> >
> > It is not the item that is nil but total_price.  If it were the item
> > that were nil then you would get an error saying that nil did not have
> > a method total_price.  Where are you setting total_price when you do
> > LineItem.new.
> >
> i belive im setting it in the current_item it self
> current_item = LineItem.new(:product_id=>product_id)
>

As I wrote above. This sets the product_id, but not
necessarily the "product" association. Check values of
* current_item.product_id
* current_item.product
right after this line.

HTH,

Peter

-- 
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