好的,伙计们,我有一个问题 - 因为我创建了一个模型和表 AdminUser,然后我尝试向它添加值,然后控制台打印我......有什么想法吗?
1.9.3-p286 :020 > AdminUser
=> AdminUser(id: integer, first_name: string, last_name: string, email: string, pass: string, date_reg: datetime, update: datetime)
1.9.3-p286 :021 > AdminUser.all
AdminUser Load (0.2ms) SELECT "admin_user".* FROM "admin_user"
=> []
1.9.3-p286 :022 > me = AdminUser
=> AdminUser(id: integer, first_name: string, last_name: string, email: string, pass: string, date_reg: datetime, update: datetime)
1.9.3-p286 :023 > me.new
ActiveRecord::DangerousAttributeError: update is defined by ActiveRecord
from /home/wojtek/.rvm/gems/ruby-1.9.3-p286/gems/activerecord-3.2.8/lib/active_record/attribute_methods.rb:91:in `instance_method_already_implemented?'
from /home/wojtek/.rvm/gems/ruby-1.9.3-p286/gems/activemodel-3.2.8/lib/active_model/attribute_methods.rb:263:in `block in define_attribute_method'
from /home/wojtek/.rvm/gems/ruby-1.9.3-p286/gems/activemodel-3.2.8/lib/active_model/attribute_methods.rb:260:in `each'
from /home/wojtek/.rvm/gems/ruby-1.9.3-p286/gems/activemodel-3.2.8/lib/active_model/attribute_methods.rb:260:in `define_attribute_method'
from /home/wojtek/.rvm/gems/ruby-1.9.3-p286/gems/activemodel-3.2.8/lib/active_model/attribute_methods.rb:256:in `block in define_attribute_methods'
from /home/wojtek/.rvm/gems/ruby-1.9.3-p286/gems/activemodel-3.2.8/lib/active_model/attribute_methods.rb:256:in `each'
from /home/wojtek/.rvm/gems/ruby-1.9.3-p286/gems/activemodel-3.2.8/lib/active_model/attribute_methods.rb:256:in `define_attribute_methods'
from /home/wojtek/.rvm/gems/ruby-1.9.3-p286/gems/activerecord-3.2.8/lib/active_record/attribute_methods.rb:66:in `block in define_attribute_methods'
from <internal:prelude>:10:in `synchronize'
from /home/wojtek/.rvm/gems/ruby-1.9.3-p286/gems/activerecord-3.2.8/lib/active_record/attribute_methods.rb:63:in `define_attribute_methods'
from /home/wojtek/.rvm/gems/ruby-1.9.3-p286/gems/activerecord-3.2.8/lib/active_record/attribute_methods.rb:168:in `respond_to?'
from /home/wojtek/.rvm/gems/ruby-1.9.3-p286/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:398:in `__run_callback'
from /home/wojtek/.rvm/gems/ruby-1.9.3-p286/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:385:in `_run_initialize_callbacks'
from /home/wojtek/.rvm/gems/ruby-1.9.3-p286/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:81:in `run_callbacks'
from /home/wojtek/.rvm/gems/ruby-1.9.3-p286/gems/activerecord-3.2.8/lib/active_record/base.rb:501:in `initialize'
from (irb):23:in `new'
from (irb):23
from /home/wojtek/.rvm/gems/ruby-1.9.3-p286/gems/railties-3.2.8/lib/rails/commands/console.rb:47:in `start'
from /home/wojtek/.rvm/gems/ruby-1.9.3-p286/gems/railties-3.2.8/lib/rails/commands/console.rb:8:in `start'
from /home/wojtek/.rvm/gems/ruby-1.9.3-p286/gems/railties-3.2.8/lib/rails/commands.rb:41:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'1.9.3-p286 :024 >