From @matheusca on November 19, 2015 22:15
Hi guys,
I've trying create association links using Roar::JSON::JSONAPI but I can't reference represented method inside of the has_one block.
For instance:
class RequesterRepresenter < Roar::Decorator
include Roar::JSON::JSONAPI
type :requester
has_one :residence_address do
type :address
link :self do
# I need way to get requester id here.
"http://example.com/requester/#{requester.id}/relationships/residence_address"
end
end
property :id
# ... other properties
end
How I described, I would need some way to get requester.id inside of has_one. Anyway to do it?
Copied from original issue: trailblazer/roar#168