orslumen/record-cache — Issue #16: Rails 3.2 - incompatible
Author: alecslupu
Created: 2012-02-01 22:33:16+00:00
State: open

Hello!
I have upgraded my application to rails 3.2, but now, unfortunately, this gem is failing.

Unfortunately i don't know how to fix it as i am a noob in rails mysef.

bundle exec rake spec --trace
** Invoke spec (first_time)
** Execute spec
/Users/alecs/.rvm/rubies/ruby-1.9.2-p290/bin/ruby -S rspec ./spec/lib/base_spec.rb ./spec/lib/dispatcher_spec.rb ./spec/lib/multi_read_spec.rb ./spec/lib/query_spec.rb ./spec/lib/statistics_spec.rb ./spec/lib/strategy/base_spec.rb ./spec/lib/strategy/index_cache_spec.rb ./spec/lib/strategy/request_cache_spec.rb ./spec/lib/strategy/unique_index_on_id_cache_spec.rb ./spec/lib/strategy/unique_index_on_string_cache_spec.rb ./spec/lib/strategy/util_spec.rb ./spec/lib/version_store_spec.rb
-- create_table(:people, {:force=>true})
-> 0.0573s
-- create_table(:stores, {:force=>true})
-> 0.0011s
-- create_table(:people_stores, {:id=>false, :force=>true})
-> 0.0007s
-- create_table(:apples, {:force=>true})
-> 0.0010s
-- create_table(:bananas, {:force=>true})
-> 0.0014s
-- create_table(:pears, {:force=>true})
-> 0.0013s
-- create_table(:addresses, {:force=>true})
-> 0.0010s
-- initialize_schema_migrations_table()
-> 0.0010s
-- assume_migrated_upto_version(0, ["db/migrate"])
-> 0.0005s
-- initialize_schema_migrations_table()
-> 0.0003s
-- assume_migrated_upto_version(1, ["db/migrate"])
-> 0.0006s
..............................................................................................................F...........*Exception in aftercommit: Failed to replace apples because one or more of the new records could not be saved.
/Users/alecs/.rvm/gems/ruby-1.9.2-p290@rvm-env/gems/activerecord-3.2.0/lib/active_record/associations/collection_association.rb:481:in `replace_records'
/Users/alecs/.rvm/gems/ruby-1.9.2-p290@rvm-env/gems/activerecord-3.2.0/lib/active_record/associations/collection_association.rb:314:in `block in replace'
/Users/alecs/.rvm/gems/ruby-1.9.2-p290@rvm-env/gems/activerecord-3.2.0/lib/active_record/associations/collection_association.rb:149:in `block in transaction'
/Users/alecs/Sites/record-cache/spec/support/after_commit.rb:21:in `block in transaction_with_transactional_fixtures'
/Users/alecs/.rvm/gems/ruby-1.9.2-p290@rvm-env/gems/activerecord-3.2.0/lib/active_record/connection_adapters/abstract/database_statements.rb:190:in `transaction'
/Users/alecs/Sites/record-cache/spec/support/after_commit.rb:19:in `transaction_with_transactional_fixtures'
/Users/alecs/.rvm/gems/ruby-1.9.2-p290@rvm-env/gems/activerecord-3.2.0/lib/active_record/transactions.rb:208:in `transaction'
/Users/alecs/.rvm/gems/ruby-1.9.2-p290@rvm-env/gems/activerecord-3.2.0/lib/active_record/associations/collection_association.rb:148:in `transaction'
/Users/alecs/.rvm/gems/ruby-1.9.2-p290@rvm-env/gems/activerecord-3.2.0/lib/active_record/associations/collection_association.rb:314:in `replace'
/Users/alecs/.rvm/gems/ruby-1.9.2-p290@rvm-env/gems/activerecord-3.2.0/lib/active_record/associations/collection_association.rb:72:in `ids_writer'
/Users/alecs/.rvm/gems/ruby-1.9.2-p290@rvm-env/gems/activerecord-3.2.0/lib/active_record/associations/builder/collection_association.rb:71:in `block in define_writers'
/Users/alecs/Sites/record-cache/spec/lib/strategy/index_cache_spec.rb:215:in `block (3 levels) in '
/Users/alecs/.rvm/gems/ruby-1.9.2-p290@rvm-env/gems/rspec-core-2.7.1/lib/rspec/core/example.rb:51:in `instance_eval'
/Users/alecs/.rvm/gems/ruby-1.9.2-p290@rvm-env/gems/rspec-core-2.7.1/lib/rspec/core/example.rb:51:in `block in run'
/Users/alecs/.rvm/gems/ruby-1.9.2-p290@rvm-env/gems/rspec-core-2.7.1/lib/rspec/core/example.rb:110:in `with_around_hooks'
/Users/alecs/.rvm/gems/ruby-1.9.2-p290@rvm-env/gems/rspec-core-2.7.1/lib/rspec/core/example.rb:48:in `run'
/Users/alecs/.rvm/gems/ruby-1.9.2-p290@rvm-env/gems/rspec-core-2.7.1/lib/rspec/core/example_group.rb:306:in `block in run_examples'
/Users/alecs/.rvm/gems/ruby-1.9.2-p290@rvm-env/gems/rspec-core-2.7.1/lib/rspec/core/example_group.rb:302:in `map'
/Users/alecs/.rvm/gems/ruby-1.9.2-p290@rvm-env/gems/rspec-core-2.7.1/lib/rspec/core/example_group.rb:302:in `run_examples'
/Users/alecs/.rvm/gems/ruby-1.9.2-p290@rvm-env/gems/rspec-core-2.7.1/lib/rspec/core/example_group.rb:274:in `run'
/Users/alecs/.rvm/gems/ruby-1.9.2-p290@rvm-env/gems/rspec-core-2.7.1/lib/rspec/core/example_group.rb:275:in `block in run'
/Users/alecs/.rvm/gems/ruby-1.9.2-p290@rvm-env/gems/rspec-core-2.7.1/lib/rspec/core/example_group.rb:275:in `map'
/Users/alecs/.rvm/gems/ruby-1.9.2-p290@rvm-env/gems/rspec-core-2.7.1/lib/rspec/core/example_group.rb:275:in `run'
/Users/alecs/.rvm/gems/ruby-1.9.2-p290@rvm-env/gems/rspec-core-2.7.1/lib/rspec/core/command_line.rb:24:in `block (2 levels) in run'
/Users/alecs/.rvm/gems/ruby-1.9.2-p290@rvm-env/gems/rspec-core-2.7.1/lib/rspec/core/command_line.rb:24:in `map'
/Users/alecs/.rvm/gems/ruby-1.9.2-p290@rvm-env/gems/rspec-core-2.7.1/lib/rspec/core/command_line.rb:24:in `block in run'
/Users/alecs/.rvm/gems/ruby-1.9.2-p290@rvm-env/gems/rspec-core-2.7.1/lib/rspec/core/reporter.rb:12:in `report'
/Users/alecs/.rvm/gems/ruby-1.9.2-p290@rvm-env/gems/rspec-core-2.7.1/lib/rspec/core/command_line.rb:21:in `run'
/Users/alecs/.rvm/gems/ruby-1.9.2-p290@rvm-env/gems/rspec-core-2.7.1/lib/rspec/core/runner.rb:80:in `run_in_process'
/Users/alecs/.rvm/gems/ruby-1.9.2-p290@rvm-env/gems/rspec-core-2.7.1/lib/rspec/core/runner.rb:69:in `run'
/Users/alecs/.rvm/gems/ruby-1.9.2-p290@rvm-env/gems/rspec-core-2.7.1/lib/rspec/core/runner.rb:10:in `block in autorun'
F................................Exception in aftercommit: Failed to replace apples because one or more of the new records could not be saved.
/Users/alecs/.rvm/gems/ruby-1.9.2-p290@rvm-env/gems/activerecord-3.2.0/lib/active_record/associations/collection_association.rb:481:in `replace_records'
/Users/alecs/.rvm/gems/ruby-1.9.2-p290@rvm-env/gems/activerecord-3.2.0/lib/active_record/associations/collection_association.rb:314:in `block in replace'
/Users/alecs/.rvm/gems/ruby-1.9.2-p290@rvm-env/gems/activerecord-3.2.0/lib/active_record/associations/collection_association.rb:149:in `block in transaction'
/Users/alecs/Sites/record-cache/spec/support/after_commit.rb:21:in `block in transaction_with_transactional_fixtures'
/Users/alecs/.rvm/gems/ruby-1.9.2-p290@rvm-env/gems/activerecord-3.2.0/lib/active_record/connection_adapters/abstract/database_statements.rb:190:in `transaction'
/Users/alecs/Sites/record-cache/spec/support/after_commit.rb:19:in `transaction_with_transactional_fixtures'
/Users/alecs/.rvm/gems/ruby-1.9.2-p290@rvm-env/gems/activerecord-3.2.0/lib/active_record/transactions.rb:208:in `transaction'
/Users/alecs/.rvm/gems/ruby-1.9.2-p290@rvm-env/gems/activerecord-3.2.0/lib/active_record/associations/collection_association.rb:148:in `transaction'
/Users/alecs/.rvm/gems/ruby-1.9.2-p290@rvm-env/gems/activerecord-3.2.0/lib/active_record/associations/collection_association.rb:314:in `replace'
/Users/alecs/.rvm/gems/ruby-1.9.2-p290@rvm-env/gems/activerecord-3.2.0/lib/active_record/associations/collection_association.rb:72:in `ids_writer'
/Users/alecs/.rvm/gems/ruby-1.9.2-p290@rvm-env/gems/activerecord-3.2.0/lib/active_record/associations/builder/collection_association.rb:71:in `block in define_writers'
/Users/alecs/Sites/record-cache/spec/lib/strategy/unique_index_on_id_cache_spec.rb:162:in `block (3 levels) in '
/Users/alecs/.rvm/gems/ruby-1.9.2-p290@rvm-env/gems/rspec-core-2.7.1/lib/rspec/core/example.rb:51:in `instance_eval'
/Users/alecs/.rvm/gems/ruby-1.9.2-p290@rvm-env/gems/rspec-core-2.7.1/lib/rspec/core/example.rb:51:in `block in run'
/Users/alecs/.rvm/gems/ruby-1.9.2-p290@rvm-env/gems/rspec-core-2.7.1/lib/rspec/core/example.rb:110:in `with_around_hooks'
/Users/alecs/.rvm/gems/ruby-1.9.2-p290@rvm-env/gems/rspec-core-2.7.1/lib/rspec/core/example.rb:48:in `run'
/Users/alecs/.rvm/gems/ruby-1.9.2-p290@rvm-env/gems/rspec-core-2.7.1/lib/rspec/core/example_group.rb:306:in `block in run_examples'
/Users/alecs/.rvm/gems/ruby-1.9.2-p290@rvm-env/gems/rspec-core-2.7.1/lib/rspec/core/example_group.rb:302:in `map'
/Users/alecs/.rvm/gems/ruby-1.9.2-p290@rvm-env/gems/rspec-core-2.7.1/lib/rspec/core/example_group.rb:302:in `run_examples'
/Users/alecs/.rvm/gems/ruby-1.9.2-p290@rvm-env/gems/rspec-core-2.7.1/lib/rspec/core/example_group.rb:274:in `run'
/Users/alecs/.rvm/gems/ruby-1.9.2-p290@rvm-env/gems/rspec-core-2.7.1/lib/rspec/core/example_group.rb:275:in `block in run'
/Users/alecs/.rvm/gems/ruby-1.9.2-p290@rvm-env/gems/rspec-core-2.7.1/lib/rspec/core/example_group.rb:275:in `map'
/Users/alecs/.rvm/gems/ruby-1.9.2-p290@rvm-env/gems/rspec-core-2.7.1/lib/rspec/core/example_group.rb:275:in `run'
/Users/alecs/.rvm/gems/ruby-1.9.2-p290@rvm-env/gems/rspec-core-2.7.1/lib/rspec/core/command_line.rb:24:in `block (2 levels) in run'
/Users/alecs/.rvm/gems/ruby-1.9.2-p290@rvm-env/gems/rspec-core-2.7.1/lib/rspec/core/command_line.rb:24:in `map'
/Users/alecs/.rvm/gems/ruby-1.9.2-p290@rvm-env/gems/rspec-core-2.7.1/lib/rspec/core/command_line.rb:24:in `block in run'
/Users/alecs/.rvm/gems/ruby-1.9.2-p290@rvm-env/gems/rspec-core-2.7.1/lib/rspec/core/reporter.rb:12:in `report'
/Users/alecs/.rvm/gems/ruby-1.9.2-p290@rvm-env/gems/rspec-core-2.7.1/lib/rspec/core/command_line.rb:21:in `run'
/Users/alecs/.rvm/gems/ruby-1.9.2-p290@rvm-env/gems/rspec-core-2.7.1/lib/rspec/core/runner.rb:80:in `run_in_process'
/Users/alecs/.rvm/gems/ruby-1.9.2-p290@rvm-env/gems/rspec-core-2.7.1/lib/rspec/core/runner.rb:69:in `run'
/Users/alecs/.rvm/gems/ruby-1.9.2-p290@rvm-env/gems/rspec-core-2.7.1/lib/rspec/core/runner.rb:10:in `block in autorun'
F......................................................................

Pending:
RecordCache::Strategy::IndexCache invalidate should invalidate indexes when using update_all
# is there a performant way to invalidate index caches within update_all? only the new value is available, so we should query the old values...
# ./spec/lib/strategy/index_cache_spec.rb:199

Failures:

1) RecordCache::Strategy::IndexCache cacheable? should not hit the cache when an :id where clause is defined
Failure/Error: lambda { Apple.where(:store_id => 1).where(:id => 1).all }.should_not hit_cache(Apple).on(:store_id)
Expected the store_id cache for Apple not to be hit at least once, but found 1: person_id => 0.0% (0/0), id => 100.0% (5/5), store_id => 100.0% (1/1)
# ./spec/lib/strategy/index_cache_spec.rb:62:in `block (3 levels) in '

2) RecordCache::Strategy::IndexCache invalidate should invalidate reflection indexes when a has_many relation is updated
Failure/Error: store1.apple_ids = store2_apple_ids
ActiveRecord::RecordNotSaved:
Failed to replace apples because one or more of the new records could not be saved.
# ./spec/support/after_commit.rb:21:in `block in transaction_with_transactional_fixtures'
# ./spec/support/after_commit.rb:19:in `transaction_with_transactional_fixtures'
# ./spec/lib/strategy/index_cache_spec.rb:215:in `block (3 levels) in '

3) RecordCache::Strategy::UniqueIndexCache invalidate should invalidate reflection indexes when a has_many relation is updated
Failure/Error: store1.apple_ids = store2_apple_ids
ActiveRecord::RecordNotSaved:
Failed to replace apples because one or more of the new records could not be saved.
# ./spec/support/after_commit.rb:21:in `block in transaction_with_transactional_fixtures'
# ./spec/support/after_commit.rb:19:in `transaction_with_transactional_fixtures'
# ./spec/lib/strategy/unique_index_on_id_cache_spec.rb:162:in `block (3 levels) in '

Finished in 3.54 seconds
227 examples, 3 failures, 1 pending

Failed examples:

rspec ./spec/lib/strategy/index_cache_spec.rb:60 # RecordCache::Strategy::IndexCache cacheable? should not hit the cache when an :id where clause is defined
rspec ./spec/lib/strategy/index_cache_spec.rb:210 # RecordCache::Strategy::IndexCache invalidate should invalidate reflection indexes when a has_many relation is updated
rspec ./spec/lib/strategy/unique_index_on_id_cache_spec.rb:157 # RecordCache::Strategy::UniqueIndexCache invalidate should invalidate reflection indexes when a has_many relation is updated
rake aborted!
ruby /Users/alecs/.rvm/rubies/ruby-1.9.2-p290/bin/ruby -S rspec ./spec/lib/base_spec.rb ./spec/lib/dispatcher_spec.rb ./spec/lib/multi_read_spec.rb ./spec/lib/query_spec.rb ./spec/lib/statistics_spec.rb ./spec/lib/strategy/base_spec.rb ./spec/lib/strategy/index_cache_spec.rb ./spec/lib/strategy/request_cache_spec.rb ./spec/lib/strategy/unique_index_on_id_cache_spec.rb ./spec/lib/strategy/unique_index_on_string_cache_spec.rb ./spec/lib/strategy/util_spec.rb ./spec/lib/version_store_spec.rb failed
/Users/alecs/.rvm/gems/ruby-1.9.2-p290@rvm-env/gems/rspec-core-2.7.1/lib/rspec/core/rake_task.rb:149:in `block (2 levels) in initialize'
/Users/alecs/.rvm/gems/ruby-1.9.2-p290@rvm-env/gems/rake-0.9.2.2/lib/rake/file_utils_ext.rb:60:in `verbose'
/Users/alecs/.rvm/gems/ruby-1.9.2-p290@rvm-env/gems/rspec-core-2.7.1/lib/rspec/core/rake_task.rb:139:in `block in initialize'
/Users/alecs/.rvm/gems/ruby-1.9.2-p290@rvm-env/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `call'
/Users/alecs/.rvm/gems/ruby-1.9.2-p290@rvm-env/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `block in execute'
/Users/alecs/.rvm/gems/ruby-1.9.2-p290@rvm-env/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `each'
/Users/alecs/.rvm/gems/ruby-1.9.2-p290@rvm-env/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `execute'
/Users/alecs/.rvm/gems/ruby-1.9.2-p290@rvm-env/gems/rake-0.9.2.2/lib/rake/task.rb:158:in `block in invoke_with_call_chain'
/Users/alecs/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/monitor.rb:201:in `mon_synchronize'
/Users/alecs/.rvm/gems/ruby-1.9.2-p290@rvm-env/gems/rake-0.9.2.2/lib/rake/task.rb:151:in `invoke_with_call_chain'
/Users/alecs/.rvm/gems/ruby-1.9.2-p290@rvm-env/gems/rake-0.9.2.2/lib/rake/task.rb:144:in `invoke'
/Users/alecs/.rvm/gems/ruby-1.9.2-p290@rvm-env/gems/rake-0.9.2.2/lib/rake/application.rb:116:in `invoke_task'
/Users/alecs/.rvm/gems/ruby-1.9.2-p290@rvm-env/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `block (2 levels) in top_level'
/Users/alecs/.rvm/gems/ruby-1.9.2-p290@rvm-env/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `each'
/Users/alecs/.rvm/gems/ruby-1.9.2-p290@rvm-env/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `block in top_level'
/Users/alecs/.rvm/gems/ruby-1.9.2-p290@rvm-env/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/Users/alecs/.rvm/gems/ruby-1.9.2-p290@rvm-env/gems/rake-0.9.2.2/lib/rake/application.rb:88:in `top_level'
/Users/alecs/.rvm/gems/ruby-1.9.2-p290@rvm-env/gems/rake-0.9.2.2/lib/rake/application.rb:66:in `block in run'
/Users/alecs/.rvm/gems/ruby-1.9.2-p290@rvm-env/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/Users/alecs/.rvm/gems/ruby-1.9.2-p290@rvm-env/gems/rake-0.9.2.2/lib/rake/application.rb:63:in `run'
/Users/alecs/.rvm/gems/ruby-1.9.2-p290@rvm-env/gems/rake-0.9.2.2/bin/rake:33:in `'
/Users/alecs/.rvm/gems/ruby-1.9.2-p290@rvm-env/bin/rake:19:in `load'
/Users/alecs/.rvm/gems/ruby-1.9.2-p290@rvm-env/bin/rake:19:in `

'