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

Method :custom_put expects an array using active_model_serializers format #469

Open
pcriv opened this issue Nov 2, 2017 · 1 comment
Open

Comments

@pcriv
Copy link

pcriv commented Nov 2, 2017

Assuming there's an endpoint account/:id/foo that updates the account and returns:

{
 "account": { "id": 1 }
}
class Account
  include Her::Model

  include_root_in_json true
  parse_root_in_json true, format: :active_model_serializers

  custom_put :foo
end

Account.foo(id: 1) 
# => NoMethodError: undefined method `map' for nil:NilClass
# => from ~/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/her-0.9.0/lib/her/model/attributes.rb:37:in `initialize_collection'
@masciugo
Copy link

masciugo commented Mar 1, 2019

same problem here with custom_patch which returns an object instead of an array. @pablocrivella did you solve this or it is still a bug?

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

2 participants