Created
August 1, 2016 21:50
-
-
Save jaimerson/bf3abf95771266a2e4062bb1b9eb2d03 to your computer and use it in GitHub Desktop.
Bikes report view approach
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 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