small medium large xlarge

05 May 2010, 16:43
deco10 (1 post)

Can somebody help me understand the self.from_cart_item() method? Its just not registering in my ol’ brain. The code works and writes to the database just fine.


class LineItem < ActiveRecord::Base belongs_to :order belongs_to :product

def self.from_cart_item(cart_item) li = li.product = cart_item.product li.quantity = cart_item.quantity li.total_price = cart_item.price li end end

You must be logged in to comment