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

Issues with active_model_serializers #644

Closed
virginia-rodriguez opened this issue May 19, 2016 · 11 comments
Closed

Issues with active_model_serializers #644

virginia-rodriguez opened this issue May 19, 2016 · 11 comments

Comments

@virginia-rodriguez
Copy link
Contributor

I was using active_model_serializers 0.9.5 with last released version of devise_token_auth (0.1.37) and everything worked fine. Then I tried to use devise_token_auth master branch to use a fix that was present there. But other changes introduced to master branch cause devise_token_auth to stop working properly (ex. sign in is broken). An exception is raised in https://github.com/lynndylanhurley/devise_token_auth/blob/master/app/controllers/devise_token_auth/application_controller.rb#L38, because ActiveModel::Serializer config is not defined.
NoMethodError (undefined method 'config' for ActiveModel::Serializer:Class):

Also, since devise_token_auth seems to be having some issues with last version of active_model_serializers (see #600), why force to use last version?

What about just replacing the conflictive line with:
ActiveModel::Serializer.respond_to?(:config) && ActiveModel::Serializer.config.adapter == :json_api

Anyone is having similar issues?

@SarSar440
Copy link

Not sure if this is related but I have since updated my Active model serializer gem and suddenly the client authentication header is now default.

@SebAshton
Copy link

@virginia-rodriguez I had this issue, and solved it by specifying version '~> 0.10.0' in my Gemfile.

e.g. gem 'active_model_serializers', '~> 0.10.0'

@augustosamame
Copy link

augustosamame commented Jun 2, 2016

I am getting a related error on sign-in / sign-up:

NoMethodError (undefined method `setup' for ActiveModel::Serializer:Class):

/home/augusto/.rvm/gems/ruby-2.3.0@faces/bundler/gems/devise_token_auth-81fc7b40998d/app/controllers/devise_token_auth/application_controller.rb:38:in `is_json_api'

I have the following in my gem file:

gem 'devise'
gem 'devise_token_auth', :git => 'git://github.com/lynndylanhurley/devise_token_auth.git'
gem 'active_model_serializers', '~> 0.10.0'

Any ideas?

Edit: I found this commit in master branch from 7 days ago which breaks things for me:

7b97279

Why is this block not working for me?

38 return ActiveModel::Serializer.setup do |config|
39 config.adapter == :json_api
40 end

Edit 2: It seems ActiveModel::Serializer respond_to? config but not to setup.
Am I missing something here?

@augustosamame
Copy link

augustosamame commented Jun 2, 2016

It turns out the setup block configuration method introduced in 7b97279 commit is not compatible with current 0.10.0 version of Active Model Serializer. I'll patch in a conditional and submit a PR soon.

@booleanbetrayal
Copy link
Collaborator

booleanbetrayal commented Jun 2, 2016

i'll merge that PR whenever you get a chance @augustosamame -- the state of things in AMS is kinda confusing these days.

@bf4
Copy link

bf4 commented Jun 2, 2016

@augustosamame just submit a revert of #648 and all will be well

@bf4
Copy link

bf4 commented Jun 2, 2016

@booleanbetrayal nah, it's pretty simple

  • 0.8 was great
  • 0.9 was a rewrite, people still use 0.8
  • 0.10 is a 0.8-incomptabile rewrite of 0.8 that was in rc for a year, and is finally out, people still use 0.8 and 0.9

:trollface: myself

@booleanbetrayal
Copy link
Collaborator

github has made it super-easy to revert without typing, which is what i just did via #652

@augustosamame
Copy link

a revert won't do since it will break compatibility with AMS 0.9.2
patch almost ready

@booleanbetrayal
Copy link
Collaborator

Should be resolved as of #651 ... Please verify as I don't have access to my dev env atm.

@augustosamame
Copy link

@woodcrust beat me to it Confirmed issue is resolved as of #651 .

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

6 participants