-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Rename ArraySerializer to CollectionSerializer for clarity #1251
Conversation
class ActiveModel::Serializer | ||
class ArraySerializer < CollectionSerializer | ||
def initialize(*) | ||
warn "Calling deprecated ArraySerializer in #{caller[0]}. Please use CollectionSerializer" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
I have a feeling pagination won't work out of the box with this. |
@bf4 Can you confirm this does not break handling of paginated collections as it previously was? I'm thinking of: https://github.com/rails-api/active_model_serializers/blob/master/lib/active_model/serializer/adapter/json_api.rb#L96 |
I guess if there aren't tests for that, there should be. @beauby, could you On Thu, Oct 8, 2015, 6:39 PM Lucas Hosseini notifications@github.com
|
The problem is that support for pagination currently relies on external gems. |
Could we add a pagination gem just in the test environment? On Thu, Oct 8, 2015, 7:17 PM Lucas Hosseini notifications@github.com
|
Better mock it up. Those usually rely on AR. |
How did you know this was broken? I didn't see anything. The gems are for sure used in tests and hence abailable, IIRC B mobile phone
|
@bf4 I don't see the gems in the Gemfile, nor have I seen any test about pagination. Could you point me to those tests? |
I'll add an integration test but where are the failures? I recall it's green B mobile phone
|
Gemspec B mobile phone
|
Wait, there have been some code changes since I posted that comment. Last I checked you got rid of the |
If so not intentional. It's just a rename B mobile phone
|
@beauby could you clarify for me what is blocking this? |
def test_json_key_with_root_and_no_serializers | ||
serializer = ArraySerializer.new(build_named_collection, root: 'custom_root') | ||
assert_equal serializer.json_key, 'custom_roots' | ||
class ArraySerializerTest < CollectionSerializerTest |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for backwards compat https://github.com/rails-api/active_model_serializers/pull/1251/files#r41372642 also, is awesome
LGTM but needs rebase. |
7d979bc
to
2c8b9b7
Compare
Rename ArraySerializer to CollectionSerializer for clarity
👍 |
No description provided.