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

Dealing with versioning in rails-api and AMS #804

Closed
chadwtaylor opened this issue Feb 3, 2015 · 2 comments
Closed

Dealing with versioning in rails-api and AMS #804

chadwtaylor opened this issue Feb 3, 2015 · 2 comments

Comments

@chadwtaylor
Copy link

Using the 0.10.x current master; Rails 4.2.

We are implementing a V2 of the Rails API using rails-api (eg: http://localhost:3000/v2/people). In V1 we used AMS and worked nicely for us. Now going into V2, we need to isolate our AMS as V2 will have its own AMS contents. I tried namespacing it like so:

module V2
  class PersonSerializer
    ...
    has_many :bids, serializer:V2::BidSerializer
  end 
end

Then we explicitly specify it in the render like so: render json:@person, serializer:V2::PersonSerializer. That worked great; however, the issue with the has_many :bids is looking at the original (V1) BidSerializer instead of V2::BidSerializer.

I googled for versioning with AMS and looks like there are discussions going on but hasn't been settled?

Meanwhile, any tips on how I should move forward with V2 implementation without having V1 take over?

Any tips are GREATLY appreciated.

@wjordan
Copy link
Contributor

wjordan commented Feb 28, 2015

My experience was that has_many with explicit serializer was not working correctly in 0.10.x current master. See PR #821 for a patch that worked for me.

@kurko kurko added the V: 0.10.x label Mar 1, 2015
@kurko
Copy link
Member

kurko commented Mar 1, 2015

#821 was just merged. Please try that for now and reopen if it doesn't work.

@kurko kurko closed this as completed Mar 1, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants