Skip to content
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

Support JSON serialize #196

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Commits on Feb 8, 2020

  1. Support JSON serialize

    If it use active hash with web api responses, `as_json` behavior is different between active hash's instance and active model's instance.
    
    ```
      1) ActiveHash Base #as_json returns a hash
         Failure/Error: expect(country.as_json).to eq({"id" => 1, "name" => "US", "language" => "English"})
    
           expected: {"id"=>1, "name"=>"US", "language"=>"English"}
                got: {"attributes"=>{"id"=>1, "name"=>"US", "language"=>"English"}}
    ```
    
    We don't need `attributes` route key.
    
    If it includes `ActiveModel::Serializers::JSON`, behavior of active hash's instance would be as same as a behavior active model's instance.
    
    Thanks :)
    yhirano55 committed Feb 8, 2020
    Configuration menu
    Copy the full SHA
    faa6f84 View commit details
    Browse the repository at this point in the history