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

Optional belongs_to association throws NoMethodError #215

Closed
rromanchuk opened this issue May 17, 2018 · 3 comments
Closed

Optional belongs_to association throws NoMethodError #215

rromanchuk opened this issue May 17, 2018 · 3 comments

Comments

@rromanchuk
Copy link

class Foo < ApplicationRecord
  belongs_to :bar, optional: true
end
class FooSerializer
  include FastJsonapi::ObjectSerializer
 
  belongs_to :bar

end

On a nil bar_id the serializer throws a fatal
NoMethodError (undefined method id' for nil:NilClass):`

@shishirmk
Copy link
Collaborator

This should be released in version 1.2 of the gem

@kevincolten
Copy link

This does not seem to be fixed in 1.2

@kevincolten
Copy link

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