Last active
May 10, 2020 19:25
-
-
Save dgorodnichy/3f05f59461c6563575d98ca5e061c4da 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 | |
private | |
def films_scope | |
Film.all | |
end | |
def serialized_films | |
FilmCarrier.wrap(films_scope).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