Created
May 10, 2020 18:48
-
-
Save dgorodnichy/a8aa3f1307204a28b42de4b1c666f910 to your computer and use it in GitHub Desktop.
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 FilmsController < ApplicationController | |
def index | |
@films = serialized_films | |
render json: @films | |
end | |
def serialized_films | |
Film.all.map do |film| | |
{ | |
title: film.title, | |
genre: film.genre, | |
rate: film.avg_rating | |
} | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment