0

I am developing a rails plugin. I have paperclip in the gemspec file:

spec.add_dependency 'paperclip', '~> 5.1'

After installing gems (using bundle install), it shows that the paperclip gem is installed in the plugin.

After adding has_attached_file in app/models/my_plugin/class_with_data_file_entity:

class ClassWithDataFileEntity < ActiveRecord::Base
  has_attached_file :file, url: "/:class/:attachment/:id_partition/:filename",
end

I see the following error:

undefined method `has_attached_file' for #<Class:0x0000000354e7e8>

So, the plugin can not find paperclip. Why would that be? Can Paperclip be used in a rails plugin

seancdavis
  • 2,739
  • 2
  • 26
  • 36
kmitov
  • 1,243
  • 3
  • 11
  • 25

1 Answers1

0

Got the answer - Rails Engine - Gems dependencies, how to load them into the application?

you have to require 'paperclip' in your engine.rb

Community
  • 1
  • 1
kmitov
  • 1,243
  • 3
  • 11
  • 25