I’ve tried this with putting the app/ of the example over mine and tried
running the whole thing but still no luck.
Im using Locomotive 2.0.8
Please someone help
I’ve tried this with putting the app/ of the example over mine and tried
running the whole thing but still no luck.
Im using Locomotive 2.0.8
Please someone help
It seems that @cart.items is returning floats, not items. Maybe check
out your cart model.
On Oct 23, 12:22 am, Zach I. [email protected]
Nothing jumps out at me as being wrong?
I know it doesn’t mind @item but when I pass it as a set of items, it
doesn’t like it.
Line 9 of line_item.rb
In Ruby, a function returns the value of the last line. The for_product
function is returning the product.price, instead of the item.
You want to add a line to return the item itself:
def self.for_product(product)
item = self.new
item.quantity = 1
item.product = product
item.unit_price = product.price
item
end
Brilliant. That’s defiantely helped. I’m now getting…
undefined local variable or method `product’
So how should I pass the product across from the model to my controller?
Getting error at:
6: product.item_product
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs