jsonapi-suite / jsonapi_compliable

MIT License
20 stars 35 forks source link

Implement has_one association for ActiveRecord Adapter #62

Closed derekcannon closed 6 years ago

derekcannon commented 6 years ago

Issue

has_one relationships don't work for the ActiveRecord Adapter

Details

Within lib/jsonapi_compliable/adapters/active_record.rb, the associate method does not take into consideration has_one relationships. This results in the adapter hitting the final elsif and attempting to send association_name to the child, instead of the parent.

That means, for example, for the new model in this PR, you would end up seeing errors like:

NoMethodError: undefined method 'salary=' for #<Salary:0x007fe9ff8d25e8>

richmolj commented 6 years ago

@derekcannon - travis should be fixed now if you rebase off of master. Once it passes we can merge! 👏