Skip to content

Instantly share code, notes, and snippets.

@pezra
Created December 16, 2011 18:41
Show Gist options
  • Save pezra/1487341 to your computer and use it in GitHub Desktop.
Save pezra/1487341 to your computer and use it in GitHub Desktop.
class Account
include HalRepresentation
property :name, String
association :members, array_of(User), rel: "http://example.com/api/rels/members"
end
a = Account.get('http://example.com/accounts/42')
a.name = "New name"
a.save # sends put of hal representation of Account to the self url
a.members # => [#<User:2342>,#<User:34242>]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment