Skip to content

Commit

Permalink
#89,#96 resolved
Browse files Browse the repository at this point in the history
  • Loading branch information
宮下 隼 authored and 宮下 隼 committed Sep 20, 2017
1 parent 79f5045 commit 7cbc578
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
8 changes: 7 additions & 1 deletion app/controllers/questions_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,13 @@ def propose
@now_question = Question.find_by(state: :open)
@now_question.update(state: :close) if @now_question
@question = Question.find_by(state: :init)
return redirect_to over_questions_url unless @question
unless @question
unless Question.any?
return redirect_to new_question_url
else
return redirect_to over_questions_url
end
end

if @question.update(state: :open)
redirect_to propose_question_url(@question)
Expand Down
1 change: 1 addition & 0 deletions app/views/shared/_header.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
<p><%= link_to 'Next Question', propose_question_path(0), class: 'btn btn-default'%></p>
<% when :over %>
<h1>以上で質問を終わります。<br>ありがとうございました。</h1>
<p><%= link_to 'Back', admin_path%></p>
<% end %>
</div>
</div>
Expand Down

0 comments on commit 7cbc578

Please sign in to comment.