在我现有的 Rails 项目中,我创建了图片模型。
class Picture < ActiveRecord::Base
belongs_to :user
end
然后,当将 Ckeditor 添加到我的项目时,我必须像这样在 ckeditor 目录下创建另一个 Picture 模型
class Ckeditor::Picture < Ckeditor::Asset
...
end
在我的用户模型中,我有这个关联 用户类 < ActiveRecord::Base has_many:图片 结束
但是,我不能使用 user.pictures
。每当我做这个声明时,就会出现以下错误:
Expected /home/xxx/app/models/ckeditor/picture.rb to define Picture
我该如何解决这个问题?
最佳答案
尝试:
class User < ActiveRecord::Base
has_many :pictures,:class_name=> "::Picture"
end
关于ruby-on-rails - 图片模型与Ckeditor::图片模型冲突,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17789559/