Possible bug > Interference with plain-old YAML serialized attributes
saurabhnanda opened this issue · 0 comments
saurabhnanda commented
Hi, it seems that this gem is interfering with the regular YAML serialization code in AR. If I include this gem in my Gemfile, I'm unable to create a new record for a model which has a YAML-serialized column, irrespective of whether it has an attribute which maps to a postgres-array column or not.
I tried the same with the ar_pg_array
gem but it doesn't have this problem.
Here's the error message I get:
NoMethodError: undefined method `serialized_value' for nil:NilClass
from /Users/saurabhnanda/.rvm/gems/ruby-1.9.3-p125@g/gems/activesupport-3.1.1/lib/active_support/whiny_nil.rb:48:in `method_missing'
from /Users/saurabhnanda/.rvm/gems/ruby-1.9.3-p125@g/gems/activerecord-postgres-array-0.0.8/lib/activerecord-postgres-array/activerecord.rb:22:in `block in arel_attributes_values'
from /Users/saurabhnanda/.rvm/gems/ruby-1.9.3-p125@g/gems/activerecord-postgres-array-0.0.8/lib/activerecord-postgres-array/activerecord.rb:13:in `each'
from /Users/saurabhnanda/.rvm/gems/ruby-1.9.3-p125@g/gems/activerecord-postgres-array-0.0.8/lib/activerecord-postgres-array/activerecord.rb:13:in `arel_attributes_values'
from /Users/saurabhnanda/.rvm/gems/ruby-1.9.3-p125@g/gems/activerecord-3.1.1/lib/active_record/persistence.rb:311:in `create'
from /Users/saurabhnanda/.rvm/gems/ruby-1.9.3-p125@g/gems/activerecord-3.1.1/lib/active_record/timestamp.rb:51:in `create'
from /Users/saurabhnanda/.rvm/gems/ruby-1.9.3-p125@g/gems/activerecord-3.1.1/lib/active_record/callbacks.rb:268:in `block in create'
from /Users/saurabhnanda/.rvm/gems/ruby-1.9.3-p125@g/gems/activesupport-3.1.1/lib/active_support/callbacks.rb:390:in `_run_create_callbacks'
from /Users/saurabhnanda/.rvm/gems/ruby-1.9.3-p125@g/gems/activesupport-3.1.1/lib/active_support/callbacks.rb:81:in `run_callbacks'
from /Users/saurabhnanda/.rvm/gems/ruby-1.9.3-p125@g/gems/activerecord-3.1.1/lib/active_record/callbacks.rb:268:in `create'
from /Users/saurabhnanda/.rvm/gems/ruby-1.9.3-p125@g/gems/activerecord-3.1.1/lib/active_record/persistence.rb:294:in `create_or_update'
from /Users/saurabhnanda/.rvm/gems/ruby-1.9.3-p125@g/gems/activerecord-3.1.1/lib/active_record/callbacks.rb:264:in `block in create_or_update'
from /Users/saurabhnanda/.rvm/gems/ruby-1.9.3-p125@g/gems/activesupport-3.1.1/lib/active_support/callbacks.rb:426:in `_run_save_callbacks'
from /Users/saurabhnanda/.rvm/gems/ruby-1.9.3-p125@g/gems/activesupport-3.1.1/lib/active_support/callbacks.rb:81:in `run_callbacks'
from /Users/saurabhnanda/.rvm/gems/ruby-1.9.3-p125@g/gems/activerecord-3.1.1/lib/active_record/callbacks.rb:264:in `create_or_update'
from /Users/saurabhnanda/.rvm/gems/ruby-1.9.3-p125@g/gems/activerecord-3.1.1/lib/active_record/persistence.rb:37:in `save'
... 1 levels...
from /Users/saurabhnanda/.rvm/gems/ruby-1.9.3-p125@g/gems/activerecord-3.1.1/lib/active_record/attribute_methods/dirty.rb:22:in `save'
from /Users/saurabhnanda/.rvm/gems/ruby-1.9.3-p125@g/gems/activerecord-3.1.1/lib/active_record/transactions.rb:241:in `block (2 levels) in save'
from /Users/saurabhnanda/.rvm/gems/ruby-1.9.3-p125@g/gems/activerecord-3.1.1/lib/active_record/transactions.rb:295:in `block in with_transaction_returning_status'
from /Users/saurabhnanda/.rvm/gems/ruby-1.9.3-p125@g/gems/activerecord-3.1.1/lib/active_record/connection_adapters/abstract/database_statements.rb:192:in `transaction'
from /Users/saurabhnanda/.rvm/gems/ruby-1.9.3-p125@g/gems/activerecord-3.1.1/lib/active_record/transactions.rb:208:in `transaction'
from /Users/saurabhnanda/.rvm/gems/ruby-1.9.3-p125@g/gems/activerecord-3.1.1/lib/active_record/transactions.rb:293:in `with_transaction_returning_status'
from /Users/saurabhnanda/.rvm/gems/ruby-1.9.3-p125@g/gems/activerecord-3.1.1/lib/active_record/transactions.rb:241:in `block in save'
from /Users/saurabhnanda/.rvm/gems/ruby-1.9.3-p125@g/gems/activerecord-3.1.1/lib/active_record/transactions.rb:252:in `rollback_active_record_state!'
from /Users/saurabhnanda/.rvm/gems/ruby-1.9.3-p125@g/gems/activerecord-3.1.1/lib/active_record/transactions.rb:240:in `save'
from /Users/saurabhnanda/.rvm/gems/ruby-1.9.3-p125@g/gems/activerecord-3.1.1/lib/active_record/base.rb:510:in `create'
from (irb):1
from /Users/saurabhnanda/.rvm/gems/ruby-1.9.3-p125@g/gems/railties-3.1.1/lib/rails/commands/console.rb:45:in `start'
from /Users/saurabhnanda/.rvm/gems/ruby-1.9.3-p125@g/gems/railties-3.1.1/lib/rails/commands/console.rb:8:in `start'
from /Users/saurabhnanda/.rvm/gems/ruby-1.9.3-p125@g/gems/railties-3.1.1/lib/rails/commands.rb:40:in `<top (required)>'
from ./script/rails:6:in `require'