Created
July 18, 2013 04:52
-
-
Save benaskins/6026794 to your computer and use it in GitHub Desktop.
Desired roar behaviour
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"departs_on":"2013-07-12", | |
"returns_on":"2013-07-19", | |
"_links": { | |
"self": { | |
"href": "http://localhost:3000/quotes/1" | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"quote": { | |
"departs_on":"2013-07-12", | |
"returns_on":"2013-07-19", | |
"_links": { | |
"self": { | |
"href": "http://localhost:3000/quotes/1" | |
} | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class QuoteRepresenter < Roar::Decorator | |
include Roar::Representer::JSON::HAL | |
property :departs_on | |
property :returns_on | |
def url | |
quote_url(represented, :host => 'http://localhost:3000') | |
end | |
link :self do | |
url | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment