Skip to content
This repository was archived by the owner on Jul 11, 2020. It is now read-only.
This repository was archived by the owner on Jul 11, 2020. It is now read-only.

Attribute check for belongs_to resolution #12

@marktran

Description

@marktran
class Resource < Daylight::API
  belongs_to :owner
end

ActiveResource supports (rails/activeresource#50) resolving a belongs_to association via a foreign key:

r = Resource.first 
=> {
  ...
  "owner_id": 42
}

or through the attribute name:

r = Resource.first 
=> {
  ...
  "owner": {
    ...
  }
}

It looks like Daylight is failing on the latter since it expects the foreign key to be present.

Relevant line:

reflection.klass.find(send(reflection.foreign_key))

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions