class Message < ActiveRecord::Base
serialize :template_data, Hash
end
This is working fine until it comes to my message_resource
class MessageResource < BaseResource
...
attribute :template_data
...
end
Which is throwing the following error
Internal Server Error: undefined method `associated_key' for #<JSONAPI::CreateResourceOperation:0x007f5867e08370> /home/ricky/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/jsonapi-resources-0.7.0/lib/jsonapi/active_record_operations_processor.rb:29:in `rescue in block in process_operation'
/home/ricky/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/jsonapi-resources-0.7.0/lib/jsonapi/active_record_operations_processor.rb:22:in `block in process_operation'
/home/ricky/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/jsonapi-resources-0.7.0/lib/jsonapi/operations_processor.rb:90:in `with_default_handling'
/home/ricky/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/jsonapi-resources-0.7.0/lib/jsonapi/active_record_operations_processor.rb:21:in `process_operation'
/home/ricky/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/jsonapi-resources-0.7.0/lib/jsonapi/operations_processor.rb:53:in `block (5 levels) in process'
...
If I remove the template_data from my resource, or remove the serialize code from my model I do not get the error and everything runs fine.
I have a text column in one of my models which I use to store serialized text in the form of a hash.
The code to perform this is:
This is working fine until it comes to my message_resource
Which is throwing the following error
If I remove the
template_data
from my resource, or remove theserialize
code from my model I do not get the error and everything runs fine.