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

Add docs for migrating from AMS. #4

Open
beauby opened this issue Nov 22, 2016 · 2 comments
Open

Add docs for migrating from AMS. #4

beauby opened this issue Nov 22, 2016 · 2 comments

Comments

@beauby
Copy link
Member

beauby commented Nov 22, 2016

Identified gotchas:

  • attribute :foo, key: :bar: in AMS, this creates a bar attribute in the JSON output. In jsonapi-rb, this becomes attribute(:bar) { @object.foo }.
  • some other stuff I haven't identified yet.
@richmolj
Copy link

As AMS has a default jsonapi type, if you change the class without adding an explicit type you get a confusing error:

ArgumentError:
       wrong number of arguments (given 0, expected 1..3)
     # /Users/lrichmond1/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/jsonapi-serializable-0.1.1.beta4/lib/jsonapi/serializable/abstract_resource.rb:78:in `instance_eval'

Defaulting type is one way to fix.

@sumeetattree
Copy link

Sorry to piggyback on this issue, but I figured this would be an appropriate place for this question.

We are currently using ams, but have run into some snags with rendering relationships properly. We want to move away from ams but we will have to do it in passes. AMS at the moment is integrated heavily in both, controller rendering and as standalone using AMS::SerializableResource with action cable.

We would like to start by replacing one serializer at a time.

  • Good news: jsonapi-rb uses different class names so no conflict with ams
  • Bad news: I see that both ams and jsonapi-rb use the same render :jsonapi construct for rendering. Is there a way in which we can make jsonapi-rb use another method? Or are we thinking about this completely the wrong way?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants