Dear all
I type the following command in script/console and got the error
“ActiveRecord::StatementInvalid: ActiveRecord::ActiveRecordError: JZ0NK:
…Statement.NO_GENERATED_KEYS”
It is quit strange that the title is nil when I saved the record…This
problem only happened in the rails console. It is no problem in my irb.
Please help me. Thank you.
user
=> #<User name: “aaa”, title: nil, created_at: “2008-11-28 07:02:26”,
updated_at: “2008-11-28 07:02:
26”>user = User.new
=> #<User name: nil, title: nil, created_at: nil, updated_at: nil>User
=> User(name: string, title: string, created_at: datetime, updated_at:
datetime)user=User.new
=> #<User name: nil, title: nil, created_at: nil, updated_at: nil>user.name = “aaaaa”
=> “aaaaa”user.title = “bbbbb”
=> “bbbbb”user
=> #<User name: “aaaaa”, title: nil, created_at: nil, updated_at: nil>user.save
ActiveRecord::StatementInvalid: ActiveRecord::ActiveRecordError: JZ0NK:
???éŠïš—î»?å‰?
?îºè›¹é›¿è¼»îœ…éˆ?Statement.NO_GENERATED_KEYS ?僎?芾?函???? INSERT INTO users
(title, created_at
, updated_at, name) VALUES(NULL, ‘2008-11-28 07:04:11’, ‘2008-11-28
07:04:11’, ‘aaaaa’)
from
C:/jruby-1.1.5/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/transactions
.rb:167:inrollback_active_record_state!' from C:/jruby-1.1.5/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/transactions .rb:146:in
save_with_transactions’
from (irb):16
from C:/jruby-1.1.5/lib/ruby/1.8/irb.rb:150:ineval_input' from C:/jruby-1.1.5/lib/ruby/1.8/irb.rb:259:in
signal_status’
from C:/jruby-1.1.5/lib/ruby/1.8/irb.rb:147:ineval_input' from C:/jruby-1.1.5/lib/ruby/1.8/irb.rb:146:in
eval_input’
from C:/jruby-1.1.5/lib/ruby/1.8/irb.rb:70:instart' from C:/jruby-1.1.5/lib/ruby/1.8/irb.rb:69:in
catch’
from C:/jruby-1.1.5/lib/ruby/1.8/irb.rb:69:in `start’
from C:/jruby-1.1.5\bin\jirb:21