0

I'm using carrierwave gem ( ver. 0.8.0 ). When I make 'rake db:migrate', I see strange error:



    ==  AddAttachmentLogoToMerchants: migrating ===================================
    -- change_table(:merchants)
    rake aborted!
    An error has occurred, this and all later migrations canceled:

    undefined method `attachment' for     ActiveRecord::ConnectionAdapters::PostgreSQLAdapter::Table:0x007f900e6bde88

My migration:




      def self.up
        change_table :merchants  do |t|
          t.attachment :logo
        end
        remove_column :merchants, :logo_filename
      end

      def self.down
        add_column :merchants, :logo_filename, :string
        drop_attached_file :merchants, :logo
      end


How can I solve it?

bmalets
  • 3,207
  • 7
  • 35
  • 64

1 Answers1

0

AFAIK in t.attachment attachment should be a datatype

change_table :merchants  do |t|
  t.attachment :logo
end

Please click here to find datatype list for postgresql If you want string following should work

change_table :merchants  do |t|
  t.string :logo
end
Salil
  • 46,566
  • 21
  • 122
  • 156