Skip to content

Commit

Permalink
Swap out KeyTransform for CaseTransform (rails-api#1993)
Browse files Browse the repository at this point in the history
* delete KeyTransform, use CaseTransform

* added changelog
  • Loading branch information
NullVoxPopuli authored and GregPK committed Apr 25, 2017
1 parent 1cec336 commit 42f9b40
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 379 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ Fixes:
Misc:

- [#1984](https://github.com/rails-api/active_model_serializers/pull/1984) Make test attributes explicit. Test models have 'associations' support. (@bf4)
- [#1993](https://github.com/rails-api/active_model_serializers/pull/1993) Swap out KeyTransform for CaseTransform gem for the possibility of native extension use (@NullVoxPopuli)

### [v0.10.3 (2016-11-21)](https://github.com/rails-api/active_model_serializers/compare/v0.10.2...v0.10.3)

Expand Down
1 change: 1 addition & 0 deletions active_model_serializers.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ Gem::Specification.new do |spec|
# 'thread_safe'

spec.add_runtime_dependency 'jsonapi', '0.1.1.beta2'
spec.add_runtime_dependency 'case_transform', '>= 0.2'

spec.add_development_dependency 'activerecord', rails_versions
# arel
Expand Down
4 changes: 2 additions & 2 deletions lib/active_model_serializers/adapter/base.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require 'active_model_serializers/key_transform'
require 'case_transform'

module ActiveModelSerializers
module Adapter
Expand Down Expand Up @@ -31,7 +31,7 @@ def self.transform(options)
# @param options [Object] serializable resource options
# @return [Symbol] the default transform for the adapter
def self.transform_key_casing!(value, options)
KeyTransform.send(transform(options), value)
CaseTransform.send(transform(options), value)
end

def self.cache_key
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ def parse_relationships(relationships, options)
# @api private
def transform_keys(hash, options)
transform = options[:key_transform] || :underscore
KeyTransform.send(transform, hash)
CaseTransform.send(transform, hash)
end
end
end
Expand Down
74 changes: 0 additions & 74 deletions lib/active_model_serializers/key_transform.rb

This file was deleted.

Loading

0 comments on commit 42f9b40

Please sign in to comment.