Last active
December 2, 2016 14:32
-
-
Save phensalves/db58c1ad3318dfadb142deefa0c87780 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 Marvel::CharactersController < ApplicationController | |
before_action :authenticate_user! | |
def index | |
@characters = Character.paginate(page: params[:page], per_page: 10) | |
get_all_characters unless @characters.present? | |
end | |
def show | |
@character = get_character | |
get_all_character_comics unless @character.comics.present? | |
end | |
private | |
def get_character | |
Character.friendly.find(params[:id]) | |
end | |
def character_params | |
params.fetch(:character, {}) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment