class Answer < ActiveRecord::Base
belongs_to :user
belongs_to :question
scope :user_answers, -> { where (user_id: current_user.id) }
scope :user_answers_with_questions, -> { joins(:questions) & Answer.user_answers }
end
Conteúdo para você se capacitar em programação
class Answer < ActiveRecord::Base
belongs_to :user
belongs_to :question
scope :user_answers, -> { where (user_id: current_user.id) }
scope :user_answers_with_questions, -> { joins(:questions) & Answer.user_answers }
end