{"action":"created","issue":{"url":"https://api.github.com/repos/cerebris/jsonapi-resources/issues/669","repository_url":"https://api.github.com/repos/cerebris/jsonapi-resources","labels_url":"https://api.github.com/repos/cerebris/jsonapi-resources/issues/669/labels{/name}","comments_url":"https://api.github.com/repos/cerebris/jsonapi-resources/issues/669/comments","events_url":"https://api.github.com/repos/cerebris/jsonapi-resources/issues/669/events","html_url":"https://github.com/cerebris/jsonapi-resources/issues/669","id":146192283,"number":669,"title":"Serialized DB column throws `undefined method `associated_key'` error","user":{"login":"rickyhopkins","id":4586254,"avatar_url":"https://avatars.githubusercontent.com/u/4586254?v=3","gravatar_id":"","url":"https://api.github.com/users/rickyhopkins","html_url":"https://github.com/rickyhopkins","followers_url":"https://api.github.com/users/rickyhopkins/followers","following_url":"https://api.github.com/users/rickyhopkins/following{/other_user}","gists_url":"https://api.github.com/users/rickyhopkins/gists{/gist_id}","starred_url":"https://api.github.com/users/rickyhopkins/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rickyhopkins/subscriptions","organizations_url":"https://api.github.com/users/rickyhopkins/orgs","repos_url":"https://api.github.com/users/rickyhopkins/repos","events_url":"https://api.github.com/users/rickyhopkins/events{/privacy}","received_events_url":"https://api.github.com/users/rickyhopkins/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-04-06T05:38:07Z","updated_at":"2016-04-06T07:16:00Z","closed_at":"2016-04-06T07:16:00Z","body":"I have a text column in one of my models which I use to store serialized text in the form of a hash.\r\n\r\n[The code to perform this](http://api.rubyonrails.org/classes/ActiveRecord/AttributeMethods/Serialization/ClassMethods.html) is:\r\n```\r\nclass Message < ActiveRecord::Base\r\n  serialize :template_data, Hash\r\nend\r\n```\r\nThis is working fine until it comes to my message_resource\r\n```\r\nclass MessageResource < BaseResource\r\n  ...\r\n  attribute :template_data\r\n  ...\r\nend\r\n```\r\nWhich is throwing the following error\r\n```\r\nInternal 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'\r\n/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'\r\n/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'\r\n/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'\r\n/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'\r\n...\r\n```\r\nIf 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."},"comment":{"url":"https://api.github.com/repos/cerebris/jsonapi-resources/issues/comments/206172215","html_url":"https://github.com/cerebris/jsonapi-resources/issues/669#issuecomment-206172215","issue_url":"https://api.github.com/repos/cerebris/jsonapi-resources/issues/669","id":206172215,"user":{"login":"rickyhopkins","id":4586254,"avatar_url":"https://avatars.githubusercontent.com/u/4586254?v=3","gravatar_id":"","url":"https://api.github.com/users/rickyhopkins","html_url":"https://github.com/rickyhopkins","followers_url":"https://api.github.com/users/rickyhopkins/followers","following_url":"https://api.github.com/users/rickyhopkins/following{/other_user}","gists_url":"https://api.github.com/users/rickyhopkins/gists{/gist_id}","starred_url":"https://api.github.com/users/rickyhopkins/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rickyhopkins/subscriptions","organizations_url":"https://api.github.com/users/rickyhopkins/orgs","repos_url":"https://api.github.com/users/rickyhopkins/repos","events_url":"https://api.github.com/users/rickyhopkins/events{/privacy}","received_events_url":"https://api.github.com/users/rickyhopkins/received_events","type":"User","site_admin":false},"created_at":"2016-04-06T07:16:00Z","updated_at":"2016-04-06T07:16:00Z","body":"Ok scratch this, it looks like there was an issue with my code which was causing the error"}}