0

Carrierwave gem ( ver. 0.8.0 ) を使用しています。「rake db:migrate」を作成すると、奇妙なエラーが表示されます。



    ==  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

私の移行:




      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


どうすれば解決できますか?

4

1 に答える 1

0

私の知る限りt.attachment attachment、データ型である必要があります

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

ここをクリックして、postgresql のデータ型リストを検索してください

change_table :merchants  do |t|
  t.string :logo
end
于 2013-04-24T13:26:27.403 に答える