ruby on rails - Taking cart id and putting into order table -
i have model order.rb :
class order < activerecord::base has_one :cart end
and model cart.rb :
class cart < activerecord::base include securelypermalinkable belongs_to :user belongs_to :order end
how can take cart_id , put in column of order table ?
thanks
michael
as said,you should doing way,you having order_id
in cart
table because associations set that
if want cart_id
in order
table have change associations.
order model
class order < activerecord::base belongs_to :cart end
cart model
class cart < activerecord::base include securelypermalinkable belongs_to :user has_one :order end
Comments
Post a Comment