Questions tagged [representable]
17 questions
0
votes
1 answer
Rails 4: Parsing JSONAPI using representable gem
I have the following working representer working for flat JSON:
# song_representer_spec.rb
require 'rails_helper'
require "representable/json"
require "representable/json/collection"
class Song < OpenStruct
end
class SongRepresenter <…

mabe02
- 2,676
- 2
- 20
- 35
0
votes
1 answer
Strategy to create multiple representations for the same class based on criteria using ROAR gem?
This is actually a best practices / usage question on hwo to use Roar & representable in Rails, as I didn't find any examples of that. Here are two scenarios. I use decorator pattern.
Scenario 1:
Let's say I have a Product class that has multiple…

konung
- 6,908
- 6
- 54
- 79