Skip to content

Resource#find Returns Arrays #75

Closed
@jakesower

Description

@jakesower

I am curious why .first is is required in this snippet (from the README):

u = MyApi::Person.find(1).first
u.update_attributes(
  a: "b",
  c: "d"
)

It makes more sense to me to do something like:

u = MyApi::Person.find(1)
u.update_attributes(
  a: "b",
  c: "d"
)

This is intentional behavior: https://github.com/chingor13/json_api_client/blob/master/lib/json_api_client/parsers/parser.rb#L62

I will be changing this logic in my fork of the repository to make it work like the second snippet above. I would be interested in the thinking behind that choice, and/or if there would be interest in merging the change from my branch into this one.

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