app/controllers/formily/iframe/forms_controller.rb in formily-0.0.5.5.7 vs app/controllers/formily/iframe/forms_controller.rb in formily-0.0.5.5.9
- old
+ new
@@ -1,28 +1,18 @@
# coding: utf-8
class Formily::Iframe::FormsController < FormilyController
-
def show
@form = Formily::Form.find(params[:id])
-
- model = params[:model_name].safe_constantize
-
- @obj_rel = model.blank? ? nil : model.find(params[:model_id])
-
- @submit = @form.submits.find_by(id: params[:submit_id])
-
- if @submit.blank?
- @submit = Formily::Submit.create({form_id: @form.id, resource_id: params[:model_id],
- user_id: params[:user_id], resource_type: params[:model_name]})
- end
+ form_model = params[:model_name].safe_constantize
+ @obj_rel = form_model.blank? ? nil : form_model.find(params[:model_id])
+ @submit = @form.find_or_create_submission_by(params)
end
def add
end
-
private
- def formily_layout
- 'formily_iframe'
- end
-end
\ No newline at end of file
+ def formily_layout
+ 'formily_iframe'
+ end
+end