Skip to content

Swap out KeyTransform for CaseTransform #1993

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd like to see this moved to the rails-api organization first. Thoughts?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm cool with that.
should we email github to just assign the existing repo to rails-api?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done


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