Paperclip 2.6.0让佣金中止!未初始化的常量AddAvatarColumnsToUser错误

时间:2012-02-16 04:44:33

标签: ruby-on-rails paperclip

我正在关注Quickstart on Github安装Paperclip并在尝试迁移数据库时遇到错误。我在下面的终端中包含了错误。我正在使用Mac OSX。我认为这与Imagemagick有关但不确定。我有paperclip 2.6.0和Rails 3.2.0。如果有人知道答案,我会非常感激,因为我没有在数小时的搜索后找到。

    Timothy-Muellers-MacBook-Pro:Publishr tmuelle1$ rake db:migrate --trace
    ** Invoke db:migrate (first_time)
    ** Invoke environment (first_time)
    ** Execute environment
    ** Invoke db:load_config (first_time)
    ** Invoke rails_env (first_time)
    ** Execute rails_env
    ** Execute db:load_config
    ** Execute db:migrate
    rake aborted!
    An error has occurred, this and all later migrations canceled:

    uninitialized constant AddAvatarColumnsToUsers
    /Users/tmuelle1/.rvm/gems/ruby-1.9.2-head@rails3tutorial/gems/activesupport-3.2.0.rc1/lib/active_support/inflector/methods.rb:226:in `block in constantize'
    /Users/tmuelle1/.rvm/gems/ruby-1.9.2-head@rails3tutorial/gems/activesupport-3.2.0.rc1/lib/active_support/inflector/methods.rb:225:in `each'
    /Users/tmuelle1/.rvm/gems/ruby-1.9.2-head@rails3tutorial/gems/activesupport-3.2.0.rc1/lib/active_support/inflector/methods.rb:225:in `constantize'
    /Users/tmuelle1/.rvm/gems/ruby-1.9.2-head@rails3tutorial/gems/activesupport-3.2.0.rc1/lib/active_support/core_ext/string/inflections.rb:54:in `constantize'
    /Users/tmuelle1/.rvm/gems/ruby-1.9.2-head@rails3tutorial/gems/activerecord-3.2.0.rc1/lib/active_record/migration.rb:521:in `load_migration'
    /Users/tmuelle1/.rvm/gems/ruby-1.9.2-head@rails3tutorial/gems/activerecord-3.2.0.rc1/lib/active_record/migration.rb:516:in `migration'
    /Users/tmuelle1/.rvm/gems/ruby-1.9.2-head@rails3tutorial/gems/activerecord-3.2.0.rc1/lib/active_record/migration.rb:511:in `migrate'
    /Users/tmuelle1/.rvm/gems/ruby-1.9.2-head@rails3tutorial/gems/activerecord-3.2.0.rc1/lib/active_record/migration.rb:696:in `block (2 levels) in migrate'
    /Users/tmuelle1/.rvm/gems/ruby-1.9.2-head@rails3tutorial/gems/activerecord-3.2.0.rc1/lib/active_record/migration.rb:751:in `call'
    /Users/tmuelle1/.rvm/gems/ruby-1.9.2-head@rails3tutorial/gems/activerecord-3.2.0.rc1/lib/active_record/migration.rb:751:in `block in ddl_transaction'
    /Users/tmuelle1/.rvm/gems/ruby-1.9.2-head@rails3tutorial/gems/activerecord-3.2.0.rc1/lib/active_record/connection_adapters/abstract/database_statements.rb:190:in `transaction'
    /Users/tmuelle1/.rvm/gems/ruby-1.9.2-head@rails3tutorial/gems/activerecord-3.2.0.rc1/lib/active_record/transactions.rb:208:in `transaction'
    /Users/tmuelle1/.rvm/gems/ruby-1.9.2-head@rails3tutorial/gems/activerecord-3.2.0.rc1/lib/active_record/migration.rb:751:in `ddl_transaction'
    /Users/tmuelle1/.rvm/gems/ruby-1.9.2-head@rails3tutorial/gems/activerecord-3.2.0.rc1/lib/active_record/migration.rb:695:in `block in migrate'
    /Users/tmuelle1/.rvm/gems/ruby-1.9.2-head@rails3tutorial/gems/activerecord-3.2.0.rc1/lib/active_record/migration.rb:676:in `each'
    /Users/tmuelle1/.rvm/gems/ruby-1.9.2-head@rails3tutorial/gems/activerecord-3.2.0.rc1/lib/active_record/migration.rb:676:in `migrate'
    /Users/tmuelle1/.rvm/gems/ruby-1.9.2-head@rails3tutorial/gems/activerecord-3.2.0.rc1/lib/active_record/migration.rb:553:in `up'
    /Users/tmuelle1/.rvm/gems/ruby-1.9.2-head@rails3tutorial/gems/activerecord-3.2.0.rc1/lib/active_record/migration.rb:534:in `migrate'
    /Users/tmuelle1/.rvm/gems/ruby-1.9.2-head@rails3tutorial/gems/activerecord-3.2.0.rc1/lib/active_record/railties/databases.rake:152:in `block (2 levels) in <top (required)>'
    /Users/tmuelle1/.rvm/gems/ruby-1.9.2-head@rails3tutorial/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `call'
    /Users/tmuelle1/.rvm/gems/ruby-1.9.2-head@rails3tutorial/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `block in execute'
    /Users/tmuelle1/.rvm/gems/ruby-1.9.2-head@rails3tutorial/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `each'
    /Users/tmuelle1/.rvm/gems/ruby-1.9.2-head@rails3tutorial/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `execute'
    /Users/tmuelle1/.rvm/gems/ruby-1.9.2-head@rails3tutorial/gems/rake-0.9.2.2/lib/rake/task.rb:158:in `block in invoke_with_call_chain'
    /Users/tmuelle1/.rvm/rubies/ruby-1.9.2-head/lib/ruby/1.9.1/monitor.rb:201:in `mon_synchronize'
    /Users/tmuelle1/.rvm/gems/ruby-1.9.2-head@rails3tutorial/gems/rake-0.9.2.2/lib/rake/task.rb:151:in `invoke_with_call_chain'
    /Users/tmuelle1/.rvm/gems/ruby-1.9.2-head@rails3tutorial/gems/rake-0.9.2.2/lib/rake/task.rb:144:in `invoke'
    /Users/tmuelle1/.rvm/gems/ruby-1.9.2-head@rails3tutorial/gems/rake-0.9.2.2/lib/rake/application.rb:116:in `invoke_task'
    /Users/tmuelle1/.rvm/gems/ruby-1.9.2-head@rails3tutorial/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `block (2 levels) in top_level'
    /Users/tmuelle1/.rvm/gems/ruby-1.9.2-head@rails3tutorial/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `each'
    /Users/tmuelle1/.rvm/gems/ruby-1.9.2-head@rails3tutorial/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `block in top_level'
    /Users/tmuelle1/.rvm/gems/ruby-1.9.2-head@rails3tutorial/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
    /Users/tmuelle1/.rvm/gems/ruby-1.9.2-head@rails3tutorial/gems/rake-0.9.2.2/lib/rake/application.rb:88:in `top_level'
    /Users/tmuelle1/.rvm/gems/ruby-1.9.2-head@rails3tutorial/gems/rake-0.9.2.2/lib/rake/application.rb:66:in `block in run'
    /Users/tmuelle1/.rvm/gems/ruby-1.9.2-head@rails3tutorial/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
    /Users/tmuelle1/.rvm/gems/ruby-1.9.2-head@rails3tutorial/gems/rake-0.9.2.2/lib/rake/application.rb:63:in `run'
    /Users/tmuelle1/.rvm/gems/ruby-1.9.2-head@rails3tutorial/gems/rake-0.9.2.2/bin/rake:33:in `<top (required)>'
    /Users/tmuelle1/.rvm/gems/ruby-1.9.2-head@rails3tutorial/bin/rake:19:in `load'
    /Users/tmuelle1/.rvm/gems/ruby-1.9.2-head@rails3tutorial/bin/rake:19:in `<main>'
    Tasks: TOP => db:migrate

1 个答案:

答案 0 :(得分:1)

这是我的错。我的用户表名为users,而不是user。我错误地逐字复制了他们所拥有的内容以及快速入门指南中的迁移说明,

class AddAvatarColumnsToUser < ActiveRecord::Migration 

而不是

class AddAvatarColumnsToUsers < ActiveRecord::Migration

这是导致错误的原因。