Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class TrainerController < ApplicationController
- before_action :find_card, only: [:review_card]
- def index
- @card = Card.needs_review.first
- end
- def review_card
- correct_answer = @card.check_translation
- if correct_answer
- flash[:notice] = "Correct"
- else
- flash[:error] = "Incorrect"
- end
- redirect_to trainer_index_path
- end
- private
- def find_card
- @card = Card.find(params[:card_id])
- end
- def trainer_params
- params.permit(:translation)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement