Guest User

Untitled

a guest
Oct 22nd, 2017
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.39 KB | None | 0 0
  1. def set_commentable
  2. @commentable = Answer.find(params[:answer_id])
  3. end
  4.  
  5. def set_voteable
  6. @voteable = Answer.find(params[:answer_id])
  7. end
  8.  
  9. def set_commentable
  10. @commentable = Question.find(params[:question_id])
  11. end
  12.  
  13. def set_voteable
  14. @voteable = Question.find(params[:question_id])
  15. end
  16.  
  17. def answer_params
  18. params.require(:answer).permit(:body)
  19. end
  20.  
  21. def find_answer
  22. @answer = Answer.find(params[:id])
  23. end
  24.  
  25.  
  26. def current_question
  27. @question = Question.find(params[:question_id])
  28. end
  29.  
  30. def comment_params
  31. params.require(:comment).permit(:body)
  32. end
  33.  
  34. def question_params
  35. params.require(:question).permit(:title, :body, :user_id)
  36. end
  37.  
  38. def find_question
  39. @question = Question.find(params[:id])
  40. end
  41.  
  42. <h2 class="text-center">Post a question</h2>
  43. <br/>
  44.  
  45. <%= form_for @question do |f| %>
  46. <%= render "shared/message" %>
  47.  
  48. <div class="form-group">
  49. <%= f.text_field :title, autofocus: true, placeholder: "Title", class: "form-control" %>
  50. </div>
  51.  
  52. <div class="form-group">
  53. <%= md_simple_editor do %>
  54. <%= f.text_area :body, autofocus: true, :rows => 6, style: 'width:100%;', placeholder: "Description", class: "form-control" %>
  55. <% end %>
  56. </div>
  57.  
  58. <div class="actions">
  59. <%= f.submit "¡Ask!", class: "btn btn-primary btn-lg btn-block" %>
  60. </div>
  61. <% end %>
  62.  
  63. <div/>
Add Comment
Please, Sign In to add comment