I have a question about the params:
How to filter the display of each user in my controller.
in my model
user.rb: has_many: questions
question.rb belongs_to: user
controller:
` skip_before_action :authenticate_user!, only: [ :new ] before_action :find_question, only: [:show, :edit, :update, :destroy]
def index
@questions = Questions.all
end
private
def find_question
@question = Question.find(params[:id])
end`
Aucun commentaire:
Enregistrer un commentaire