Reputation: 8062
in my Rails 3.2 app with Spree I'd like to have a WishList
model that has a has_many
relationship regarding to the Spree::Product
model provided by Spree. I have already created a decorator class to declare a belongs_to
relationship into Spree::Product
but how can I refer to Spree::Product
inside another model I've created myself.
I tried both
class WishList < ActiveRecord::Base
has_many :products
end
and
class WishList < ActiveRecord::Base
has_many :spree_products
end
and none of them worked. Please help.
Upvotes: 1
Views: 848
Reputation: 35531
Use the :class_name
option:
class WishList < ActiveRecord::Base
has_many :spree_products, :class_name => 'Spree::Product'
end
Upvotes: 3