我已经发现一些人修复了这个问题,修改了 attr_accessible 但我认为这个错误可能出在 gem rake 本身?
rake --trace db:seed
-- 日志输出开始 --
** Invoke db:seed (first_time)
** Execute db:seed
** Invoke db:abort_if_pending_migrations (first_time)
** Invoke environment (first_time)
** Execute environment
** Invoke db:load_config (first_time)
** Execute db:load_config
** Execute db:abort_if_pending_migrations
rake aborted!
Can't mass-assign protected attributes: authentication_token
/Users/devx/.rvm/gems/ruby-1.9.3-p362/gems/activemodel-3.2.8/lib/active_model/mass_assignment_security/sanitizer.rb:48:in `process_removed_attributes'
/Users/devx/.rvm/gems/ruby-1.9.3-p362/gems/activemodel-3.2.8/lib/active_model/mass_assignment_security/sanitizer.rb:20:in `debug_protected_attribute_removal'
/Users/devx/.rvm/gems/ruby-1.9.3-p362/gems/activemodel-3.2.8/lib/active_model/mass_assignment_security/sanitizer.rb:12:in `sanitize'
/Users/devx/.rvm/gems/ruby-1.9.3-p362/gems/activemodel-3.2.8/lib/active_model/mass_assignment_security.rb:230:in `sanitize_for_mass_assignment'
/Users/devx/.rvm/gems/ruby-1.9.3-p362/gems/activerecord-3.2.8/lib/active_record/attribute_assignment.rb:75:in `assign_attributes'
/Users/devx/.rvm/gems/ruby-1.9.3-p362/gems/activerecord-3.2.8/lib/active_record/base.rb:498:in `initialize'
/Users/devx/.rvm/gems/ruby-1.9.3-p362/gems/activerecord-3.2.8/lib/active_record/persistence.rb:44:in `new'
/Users/devx/.rvm/gems/ruby-1.9.3-p362/gems/activerecord-3.2.8/lib/active_record/persistence.rb:44:in `create'
/Users/devx/passbook_rails_example/db/seeds.rb:1:in `<top (required)>'
/Users/devx/.rvm/gems/ruby-1.9.3-p362/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:245:in `load'
/Users/devx/.rvm/gems/ruby-1.9.3-p362/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:245:in `block in load'
/Users/devx/.rvm/gems/ruby-1.9.3-p362/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:236:in `load_dependency'
/Users/devx/.rvm/gems/ruby-1.9.3-p362/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:245:in `load'
/Users/devx/.rvm/gems/ruby-1.9.3-p362/gems/railties-3.2.8/lib/rails/engine.rb:520:in `load_seed'
/Users/devx/.rvm/gems/ruby-1.9.3-p362/gems/activerecord-3.2.8/lib/active_record/railties/databases.rake:309:in `block (2 levels) in <top (required)>'
/Users/devx/.rvm/gems/ruby-1.9.3-p362/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `call'
/Users/devx/.rvm/gems/ruby-1.9.3-p362/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `block in execute'
/Users/devx/.rvm/gems/ruby-1.9.3-p362/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `each'
/Users/devx/.rvm/gems/ruby-1.9.3-p362/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `execute'
/Users/devx/.rvm/gems/ruby-1.9.3-p362/gems/rake-0.9.2.2/lib/rake/task.rb:158:in `block in invoke_with_call_chain'
/Users/devx/.rvm/rubies/ruby-1.9.3-p362/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
/Users/devx/.rvm/gems/ruby-1.9.3-p362/gems/rake-0.9.2.2/lib/rake/task.rb:151:in `invoke_with_call_chain'
/Users/devx/.rvm/gems/ruby-1.9.3-p362/gems/rake-0.9.2.2/lib/rake/task.rb:144:in `invoke'
/Users/devx/.rvm/gems/ruby-1.9.3-p362/gems/rake-0.9.2.2/lib/rake/application.rb:116:in `invoke_task'
/Users/devx/.rvm/gems/ruby-1.9.3-p362/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `block (2 levels) in top_level'
/Users/devx/.rvm/gems/ruby-1.9.3-p362/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `each'
/Users/devx/.rvm/gems/ruby-1.9.3-p362/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `block in top_level'
/Users/devx/.rvm/gems/ruby-1.9.3-p362/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/Users/devx/.rvm/gems/ruby-1.9.3-p362/gems/rake-0.9.2.2/lib/rake/application.rb:88:in `top_level'
/Users/devx/.rvm/gems/ruby-1.9.3-p362/gems/rake-0.9.2.2/lib/rake/application.rb:66:in `block in run'
/Users/devx/.rvm/gems/ruby-1.9.3-p362/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/Users/devx/.rvm/gems/ruby-1.9.3-p362/gems/rake-0.9.2.2/lib/rake/application.rb:63:in `run'
/Users/devx/.rvm/gems/ruby-1.9.3-p362/gems/rake-0.9.2.2/bin/rake:33:in `<top (required)>'
/Users/devx/.rvm/gems/ruby-1.9.3-p362/bin/rake:19:in `load'
/Users/devx/.rvm/gems/ruby-1.9.3-p362/bin/rake:19:in `<main>'
/Users/devx/.rvm/gems/ruby-1.9.3-p362/bin/ruby_noexec_wrapper:14:in `eval'
/Users/devx/.rvm/gems/ruby-1.9.3-p362/bin/ruby_noexec_wrapper:14:in `<main>'
Tasks: TOP => db:seed
-- 日志输出结束 --