{"action":"created","issue":{"url":"https://api.github.com/repos/rails-api/active_model_serializers/issues/1591","repository_url":"https://api.github.com/repos/rails-api/active_model_serializers","labels_url":"https://api.github.com/repos/rails-api/active_model_serializers/issues/1591/labels{/name}","comments_url":"https://api.github.com/repos/rails-api/active_model_serializers/issues/1591/comments","events_url":"https://api.github.com/repos/rails-api/active_model_serializers/issues/1591/events","html_url":"https://github.com/rails-api/active_model_serializers/issues/1591","id":140674266,"number":1591,"title":"Option for overriding format of type globally","user":{"login":"chrisdpeters","id":159187,"avatar_url":"https://avatars.githubusercontent.com/u/159187?v=3","gravatar_id":"","url":"https://api.github.com/users/chrisdpeters","html_url":"https://github.com/chrisdpeters","followers_url":"https://api.github.com/users/chrisdpeters/followers","following_url":"https://api.github.com/users/chrisdpeters/following{/other_user}","gists_url":"https://api.github.com/users/chrisdpeters/gists{/gist_id}","starred_url":"https://api.github.com/users/chrisdpeters/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chrisdpeters/subscriptions","organizations_url":"https://api.github.com/users/chrisdpeters/orgs","repos_url":"https://api.github.com/users/chrisdpeters/repos","events_url":"https://api.github.com/users/chrisdpeters/events{/privacy}","received_events_url":"https://api.github.com/users/chrisdpeters/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2016-03-14T13:33:41Z","updated_at":"2016-03-14T15:33:54Z","closed_at":null,"body":"#### Expected behavior vs actual behavior\r\n\r\nPer [this comment](https://github.com/rails-api/active_model_serializers/issues/974#issuecomment-119959744), I am overriding much of what I need to in order to get JSON API-style output with dasherized keys.\r\n\r\nHere is what I'm doing exactly with a `BaseSerializer` that other serializers extend:\r\n\r\n```ruby\r\nclass BaseSerializer < ActiveModel::Serializer\r\n  def attributes(*args)\r\n    Hash[super.map do |key, value|\r\n      [transform_key(key), value]\r\n    end]\r\n  end\r\n\r\n  def each_association(&block)\r\n    super do |key, association, opts|\r\n      if block_given?\r\n        block.call transform_key(key), association, opts\r\n      end\r\n    end\r\n  end\r\n\r\nprivate\r\n\r\n  def transform_key(key)\r\n    key.to_s.dasherize.to_sym\r\n  end\r\nend\r\n```\r\n\r\nThe last element that I need to cover is the `type`, which I can't seem to find a hook to include in this base serializer. Is that possible, or can it be added so that I can use it in the base class?\r\n\r\nFor now, I need to manually call `type` in each multi-word serializer, which I find to be less than ideal when it was possible to override everything else in the base:\r\n\r\n```ruby\r\nclass ContentTemplateSerializer < BaseSerializer\r\n  type 'content-templates'\r\nend\r\n```\r\n\r\n#### Environment\r\n\r\nActiveModelSerializers Version *(commit ref if not on tag)*: 0.10.0.rc4\r\n\r\nOutput of `ruby -e \"puts RUBY_DESCRIPTION\"`: ruby 2.2.3p173 (2015-08-18 revision 51636) [x86_64-linux]\r\n\r\nOS Type & Version: Ubuntu 14.04\r\n\r\nIntegrated application and version *(e.g., Rails, Grape, etc)*: Rails"},"comment":{"url":"https://api.github.com/repos/rails-api/active_model_serializers/issues/comments/196370217","html_url":"https://github.com/rails-api/active_model_serializers/issues/1591#issuecomment-196370217","issue_url":"https://api.github.com/repos/rails-api/active_model_serializers/issues/1591","id":196370217,"user":{"login":"remear","id":40956,"avatar_url":"https://avatars.githubusercontent.com/u/40956?v=3","gravatar_id":"","url":"https://api.github.com/users/remear","html_url":"https://github.com/remear","followers_url":"https://api.github.com/users/remear/followers","following_url":"https://api.github.com/users/remear/following{/other_user}","gists_url":"https://api.github.com/users/remear/gists{/gist_id}","starred_url":"https://api.github.com/users/remear/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/remear/subscriptions","organizations_url":"https://api.github.com/users/remear/orgs","repos_url":"https://api.github.com/users/remear/repos","events_url":"https://api.github.com/users/remear/events{/privacy}","received_events_url":"https://api.github.com/users/remear/received_events","type":"User","site_admin":false},"created_at":"2016-03-14T15:33:54Z","updated_at":"2016-03-14T15:33:54Z","body":"Keep in mind, in #1574 the default transform for the `JsonApi` adapter is `:dashed`."}}