rails generate paperclip_database:migration getting protected method `migration_file_name’ errorPosted: June 6, 2014 | Author: ThomasPowell | Filed under: daily learning | Tags: gem, paperclip, rails4 | Comments Off on rails generate paperclip_database:migration getting protected method `migration_file_name’ error
Quick fix (put this in
application.rb or similar in order to run the
rails generate paperclip_databasee:migration command):
module PaperclipDatabase module Generators class MigrationGenerator public :migration_file_name end end end
There are two errors causing this error, one in paperclip and one in paperclip_database. Not sure what changes to Rails 4 caused this, but the issue is fixed in this commit in paperclip, which probably needs to be mirrored in paperclip_database. (Even if I point to the github repo for paperclip, I still get the error due to
protected being specified on paperclip_database as well.
The error only appears to affect the generator.
If you’d rather not have a temporary monkey patch, you can write the migration by hand:
Example (for a
User with an
class CreateUserAvatar < ActiveRecord::Migration def self.up create_table :avatars do |t| t.integer :user_id t.string :style t.binary :file_contents end end def self.down drop_table :avatars end end