Paperclip:模块的未定义方法`new'

时间:2012-02-14 03:49:49

标签: ruby-on-rails ruby paperclip

我遇到Paperclip:Module 错误未定义方法`new' 运行rake db:migrate to update table for PaperClip。

此处为迁移类

class ForPaperclip < ActiveRecord::Migration
  def self.up
    change_table :photos do |t|
      t.has_attached_file :shot
    end
  end

  def self.down
    drop_attached_file :photos, :shot
  end
end

我使用的是paperclip 2.6.0,ruby 1.9.2,rails 3.1.0 有什么想法吗?

下面是错误堆栈。

/Users/Sa/.rvm/gems/ruby-1.9.2-p290/gems/activerecord-3.1.0/lib/active_record/migration.rb:517:in `load_migration'

/Users/Sa/.rvm/gems/ruby-1.9.2-p290/gems/activerecord-3.1.0/lib/active_record/migration.rb:512:in `migration'

/Users/Sa/.rvm/gems/ruby-1.9.2-p290/gems/activerecord-3.1.0/lib/active_record/migration.rb:509:in `rescue in migrate'

/Users/Sa/.rvm/gems/ruby-1.9.2-p290/gems/activerecord-3.1.0/lib/active_record/migration.rb:507:in `migrate'

1 个答案:

答案 0 :(得分:0)

抱歉,这真是我的坏事。我创建了名为* _paperclip.txt的迁移文件,因此rails不必要地查找Paperclip模块。重命名迁移文件

后,它工作正常