Created
December 18, 2021 08:35
-
-
Save micedreams/0c6686578ecda131ec8ad20c8047f7d3 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
def create | |
@question = Question.new(question_params) | |
respond_to do |format| | |
if @question.save | |
format.html { redirect_to @question, notice: "Question was successfully created." } | |
format.json { render :show, status: :created, location: @question } | |
else | |
format.html { render :new, status: :unprocessable_entity } | |
format.json { render json: @question.errors, status: :unprocessable_entity } | |
end | |
end | |
end |
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
#create method from quiz controller | |
def create | |
@quiz = Quiz.new(quiz_params) | |
respond_to do |format| | |
if @quiz.save | |
# should take to add new questiom | |
format.html { redirect_to new_quiz_question_path(@quiz), notice: "Quiz was successfully created." } | |
format.json { render :show, status: :created, location: @quiz } | |
else | |
format.html { render :new, status: :unprocessable_entity } | |
format.json { render json: @quiz.errors, status: :unprocessable_entity } | |
end | |
end | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment