Sha256: 60880dbf38cb5039be70bfbb6ed9410213a2f626bb1b3f2e78d354be09ef3839
Contents?: true
Size: 1.25 KB
Versions: 4
Compression:
Stored size: 1.25 KB
Contents
class FormAnswersController < ApplicationController respond_to :html, :json 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 def index respond_with ActiveadminSelleoCms::FormAnswer.where(form_uuid: params[:form_uuid]) end def edit @form_answer = ActiveadminSelleoCms::FormAnswer.find(params[:id]) end def update @form_answer = ActiveadminSelleoCms::FormAnswer.find(params[:id]) @form_answer.update_attributes(params[:form_answer]) end 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 def attachments 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 end
Version data entries
4 entries across 4 versions & 1 rubygems