【发布时间】:2017-05-08 17:54:54
【问题描述】:
我正在开发一个 Rails 插件。我在 gemspec 文件中有回形针:
spec.add_dependency 'paperclip', '~> 5.1'
安装gems后(使用bundle install),显示插件中安装了回形针gem。
在app/models/my_plugin/class_with_data_file_entity中添加has_attached_file后:
class ClassWithDataFileEntity < ActiveRecord::Base
has_attached_file :file, url: "/:class/:attachment/:id_partition/:filename",
end
我看到以下错误:
undefined method `has_attached_file' for #<Class:0x0000000354e7e8>
所以,插件找不到回形针。为什么会这样?回形针可以在rails插件中使用吗
【问题讨论】:
标签: ruby-on-rails ruby-on-rails-4 paperclip