Rails 3.2 で ActiveRecord::RecordNotSaved を受け取りましたが、その理由がわかりません。私に発生する唯一のことは、ある種の宝石の競合ですが、それ以外は、このエラーは、私が知る限り、Rails のすべての規則とドキュメントに反しています。
私の正気は急速に危険にさらされているため、どんな助けも高く評価されます.
ActiveRecord クラス
=begin
create_table "decks", :force => true do |t|
t.string "name"
t.string "deck_type"
t.datetime "created_at"
t.datetime "updated_at"
t.integer "user_id"
t.integer "core_deck_id"
t.datetime "published"
t.datetime "deleted_at"
t.boolean "customizable"
t.integer "deck_group_id"
t.boolean "has_sections"
t.string "solid_filename_mac"
t.string "solid_filename_pc"
end
=end
class Deck < ActiveRecord::Base
attr_accessible :name
end
次のエラーが表示されます。
1.9.3p433 :001 > @deck = Deck.find 6850
Deck Load (0.6ms) SELECT `decks`.* FROM `decks` WHERE `decks`.`id` = 6850 LIMIT 1
=> #<Deck id: 6850, name: "____lizztest2", deck_type: "core", created_at: "2013-04-15 14:57:38", updated_at: "2013-04-15 18:43:04", user_id: nil, core_deck_id: nil, published: "2013-04-15 18:43:04", deleted_at: nil, customizable: true, deck_group_id: nil, has_sections: false, solid_filename_mac: nil, solid_filename_pc: nil>
1.9.3p433 :002 > @deck.update_attributes!({name: 'new_name'})
(0.2ms) BEGIN
(0.1ms) ROLLBACK
ActiveRecord::RecordNotSaved: ActiveRecord::RecordNotSaved
from /Users/bliff/.rvm/gems/ruby-1.9.3-head@pss/gems/activerecord-3.2.11/lib/active_record/persistence.rb:104:in `save!'
from /Users/bliff/.rvm/gems/ruby-1.9.3-head@pss/gems/activerecord-3.2.11/lib/active_record/validations.rb:56:in `save!'
from /Users/bliff/.rvm/gems/ruby-1.9.3-head@pss/gems/activerecord-3.2.11/lib/active_record/attribute_methods/dirty.rb:33:in `save!'
from /Users/bliff/.rvm/gems/ruby-1.9.3-head@pss/gems/activerecord-3.2.11/lib/active_record/transactions.rb:264:in `block in save!'
from /Users/bliff/.rvm/gems/ruby-1.9.3-head@pss/gems/activerecord-3.2.11/lib/active_record/transactions.rb:313:in `block in with_transaction_returning_status'
from /Users/bliff/.rvm/gems/ruby-1.9.3-head@pss/gems/activerecord-3.2.11/lib/active_record/connection_adapters/abstract/database_statements.rb:192:in `transaction'
from /Users/bliff/.rvm/gems/ruby-1.9.3-head@pss/gems/activerecord-3.2.11/lib/active_record/transactions.rb:208:in `transaction'
from /Users/bliff/.rvm/gems/ruby-1.9.3-head@pss/gems/activerecord-3.2.11/lib/active_record/transactions.rb:311:in `with_transaction_returning_status'
from /Users/bliff/.rvm/gems/ruby-1.9.3-head@pss/gems/activerecord-3.2.11/lib/active_record/transactions.rb:264:in `save!'
from /Users/bliff/.rvm/gems/ruby-1.9.3-head@pss/gems/activerecord-3.2.11/lib/active_record/persistence.rb:228:in `block in update_attributes!'
from /Users/bliff/.rvm/gems/ruby-1.9.3-head@pss/gems/activerecord-3.2.11/lib/active_record/transactions.rb:313:in `block in with_transaction_returning_status'
from /Users/bliff/.rvm/gems/ruby-1.9.3-head@pss/gems/activerecord-3.2.11/lib/active_record/connection_adapters/abstract/database_statements.rb:192:in `transaction'
from /Users/bliff/.rvm/gems/ruby-1.9.3-head@pss/gems/activerecord-3.2.11/lib/active_record/transactions.rb:208:in `transaction'
from /Users/bliff/.rvm/gems/ruby-1.9.3-head@pss/gems/activerecord-3.2.11/lib/active_record/transactions.rb:311:in `with_transaction_returning_status'
from /Users/bliff/.rvm/gems/ruby-1.9.3-head@pss/gems/activerecord-3.2.11/lib/active_record/persistence.rb:226:in `update_attributes!'
from (irb):2
from /Users/bliff/.rvm/gems/ruby-1.9.3-head@pss/gems/railties-3.2.11/lib/rails/commands/console.rb:47:in `start'
from /Users/bliff/.rvm/gems/ruby-1.9.3-head@pss/gems/railties-3.2.11/lib/rails/commands/console.rb:8:in `start'
from /Users/bliff/.rvm/gems/ruby-1.9.3-head@pss/gems/railties-3.2.11/lib/rails/commands.rb:41:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'1.9.3p433 :003 >
そして、ここに私のGemfileがあります:
source 'https://rubygems.org'
gem 'rails', '3.2.11'
gem 'mysql2'
group :assets do
gem 'sass-rails', '~> 3.2.3'
gem 'coffee-rails', '~> 3.2.1'
gem 'therubyracer', :platforms => :ruby
gem 'uglifier', '>= 1.0.3'
gem 'yui-compressor'
end
gem 'acts-as-taggable-on'
gem 'authlogic'
gem 'daemons' # for delayed_job
gem 'delayed_job'
gem 'delayed_job_active_record'
gem 'dynamic_form'
gem 'fastercsv'
gem 'jquery-rails'
gem 'meta_search'
gem 'nokogiri'
gem 'paranoia'
gem 'paperclip', :git => "git://github.com/thoughtbot/paperclip.git"
gem 'query_trace'
gem 'rdoc'
gem 'will_paginate'
group :test do
gem 'database_cleaner'
gem 'factory_girl_rails'
gem 'paperclip-matchers'
gem 'rspec'
gem 'rspec-rails'
gem 'shoulda'
end