Skip to content

Instantly share code, notes, and snippets.

@statonjr
Created February 5, 2013 01:37
Show Gist options
  • Save statonjr/4711393 to your computer and use it in GitHub Desktop.
Save statonjr/4711393 to your computer and use it in GitHub Desktop.
require 'roar/representer/json'
require 'roar/representer/json/hal'
require 'roar/representer/feature/hypermedia'
require 'lib/api/representers/dealership_representer'
module DealershipsRepresenter
include Roar::Representer::JSON
include Roar::Representer::JSON::HAL
include Roar::Representer::Feature::Hypermedia
link :self do
".../ds"
end
collection :dealerships, :rel => ".../rels/dealerships", :class => Motor::Dealership, :extend => DealershipRepresenter, :embedded => true
end
def from
(options[:from] || options[:as] || options[:rel] || name ).to_s
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment