Class: FormAnswersController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- FormAnswersController
- Defined in:
- app/controllers/form_answers_controller.rb
Instance Method Summary collapse
- #attachments ⇒ Object
- #create ⇒ Object
- #edit ⇒ Object
- #find_or_create ⇒ Object
- #index ⇒ Object
- #update ⇒ Object
Instance Method Details
#attachments ⇒ Object
33 34 35 36 37 38 39 |
# File 'app/controllers/form_answers_controller.rb', line 33 def if @form_answer = ActiveadminSelleoCms::FormAnswer.where(form_uuid: params[:form_uuid], form_question_id: params[:form_question_id]).first render partial: 'attachments' else render nothing: true end end |
#create ⇒ Object
5 6 7 8 9 10 11 12 13 |
# File 'app/controllers/form_answers_controller.rb', line 5 def create params[:form_answer] ||= {} if answer = ActiveadminSelleoCms::FormAnswer.where(form_uuid: params[:form_answer][:form_uuid], dom_id: params[:form_answer][:dom_id]).first answer.update_attribute(:value, params[:form_answer][:value]) else ActiveadminSelleoCms::FormAnswer.create(params[:form_answer]) end render nothing: true end |
#edit ⇒ Object
19 20 21 |
# File 'app/controllers/form_answers_controller.rb', line 19 def edit @form_answer = ActiveadminSelleoCms::FormAnswer.find(params[:id]) end |
#find_or_create ⇒ Object
28 29 30 31 |
# File 'app/controllers/form_answers_controller.rb', line 28 def find_or_create @form_answer = ActiveadminSelleoCms::FormAnswer.find_or_create_by_form_uuid_and_dom_id_and_form_question_id(params[:form_uuid], params[:dom_id], params[:form_question_id]) render action: :edit end |
#index ⇒ Object
15 16 17 |
# File 'app/controllers/form_answers_controller.rb', line 15 def index respond_with ActiveadminSelleoCms::FormAnswer.where(form_uuid: params[:form_uuid]) end |
#update ⇒ Object
23 24 25 26 |
# File 'app/controllers/form_answers_controller.rb', line 23 def update @form_answer = ActiveadminSelleoCms::FormAnswer.find(params[:id]) @form_answer.update_attributes(params[:form_answer]) end |