Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ruby/23.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails 如何:Spree::Product与其他模型之间的关系_Ruby On Rails_Ruby_E Commerce_Spree - Fatal编程技术网

Ruby on rails 如何:Spree::Product与其他模型之间的关系

Ruby on rails 如何:Spree::Product与其他模型之间的关系,ruby-on-rails,ruby,e-commerce,spree,Ruby On Rails,Ruby,E Commerce,Spree,在我的带有Spree的Rails 3.2应用程序中,我希望有一个WishList模型,它与Spree提供的Spree::Product模型有很多关系。我已经创建了一个decorator类,将所属的关系声明为Spree::Product,但是如何在我自己创建的另一个模型中引用Spree::Product 我两个都试过了 class WishList < ActiveRecord::Base has_many :products end class-WishList

在我的带有Spree的Rails 3.2应用程序中,我希望有一个
WishList
模型,它与Spree提供的
Spree::Product
模型有很多关系。我已经创建了一个decorator类,将
所属的关系声明为
Spree::Product
,但是如何在我自己创建的另一个模型中引用
Spree::Product

我两个都试过了

class WishList < ActiveRecord::Base
  has_many :products
end
class-WishList

class-WishList

他们都没有成功。请提供帮助。

使用
:class\u name
选项:

class WishList < ActiveRecord::Base
  has_many :spree_products, :class_name => 'Spree::Product'
end
class-WishList'spree::Product'
结束
class WishList < ActiveRecord::Base
  has_many :spree_products, :class_name => 'Spree::Product'
end