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

Coerce include, embed, embed_ids #32

Open
zorbash opened this issue Apr 4, 2015 · 0 comments
Open

Coerce include, embed, embed_ids #32

zorbash opened this issue Apr 4, 2015 · 0 comments
Milestone

Comments

@zorbash
Copy link
Contributor

zorbash commented Apr 4, 2015

Associations may be eagerly fetched as documented.

Current behavior for embed:

locations = client.shops(11).locations(embed: 'address')
address = locations.first.address
# => {"id"=>2, "street_number"=>"1", "street"=>"ΘΕΣΗ ΣΚΛΗΡΙ", "postcode"=>"19600", "city"=>"ΜΑΓΟΥΛΑ",
# "region"=>"Αττικής", "country"=>"Ελλάδα"}

address.class
# => Hash

Expected behavior:

locations = client.shops(11).locations(embed: 'address')
address = locations.first.address
# =>  #<Skroutz::Address id: 2, street_number: "1", street: "ΘΕΣΗ ΣΚΛΗΡΙ", postcode: "19600", city: 
# "ΜΑΓΟΥΛΑ", region: "Αττικής", country: "Ελλάδα">

address.class
# =>  Skroutz::Address
@zorbash zorbash added this to the v0.2.0 milestone Apr 4, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant