On May 5, 2010, at 3:21 PM, dev wrote:
For some reason I am tripping up on the use of self and new.
class LineItem < ActiveRecord::Base
belongs_to :order
belongs_to :product
def self.from_cart_item(cart_item)
li = self.new
li.product = cart_item.product
li.quantity = cart_item.quan
I don't know for sure because I haven't encountered a situation where I'd
need to do things like this... But I'll give it a shot - I'm open to
corrections..
class LineItem < ActiveRecord::Base
belongs_to :order
belongs_to :product
def self.from_cart_item(cart_item)
li = ne
For some reason I am tripping up on the use of self and new.
class LineItem < ActiveRecord::Base
belongs_to :order
belongs_to :product
def self.from_cart_item(cart_item)
li = self.new
li.product = cart_item.product
li.quantity = cart_item.quantity
li.total_price = cart_item.
3 matches
Mail list logo