Skip to content

Instantly share code, notes, and snippets.

@jaimerson
Created August 1, 2016 21:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jaimerson/bf3abf95771266a2e4062bb1b9eb2d03 to your computer and use it in GitHub Desktop.
Save jaimerson/bf3abf95771266a2e4062bb1b9eb2d03 to your computer and use it in GitHub Desktop.
Bikes report view approach
class BikesReport::ViewApproach
def to_a
BikesReport
.all
.as_json
.map { |r| r.symbolize_keys!.merge!(model: MODELS.fetch(r[:model])) }
end
private
MODELS = Bike.models.invert.freeze
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment