Error in Paperclip in a project which uses Rails 4 (Spree 2.2)

Error in Paperclip in a project which uses Rails 4 (Spree 2.2)

I decided to add a new image for a product in spree and in that scenario there is a generator provided by paperclip with the purpose of generate that new attachment I tried to run the following command:

rails generate paperclip spree_products specs

Buuuuuuuut I received the following error:

`migration_file_name’: protected method `migration_file_name’ called for # (NoMethodError)

So what I did to fix the error was removing temporally a protected tag inside the paperclip generator and then run again my generator, for instance:

Open the gem using vim

EDITOR=vim bundle open paperclip

Once you have open vim editor you have to open the file:
lib/generators/paperclip/paperclip_generator.rb

Opening in vim the previous file:

:e lib/generators/paperclip/paperclip_generator.rb

And just remove temporally the line:

protected

And now let’s save it in vim using “:w” and press enter

And now if you try again the generator it’s going to work like a charm, and then you can undo the change or save it and continuing working in your app :)

H.

No Comments

Post A Comment