app/controllers/para/admin/form_resources_controller.rb in para-0.6.9 vs app/controllers/para/admin/form_resources_controller.rb in para-0.7.0

- old
+ new

@@ -1,15 +1,17 @@ require_dependency "para/application_controller" module Para module Admin class FormResourcesController < Para::Admin::ResourcesController - include Para::Admin::ResourceControllerConcerns - before_action :load_and_authorize_form after_action :attach_resource_to_component, only: [:create] + # Include after resource loading to allow the concern to use the resource + # in before_action hooks + include Para::Admin::ResourceControllerConcerns + private def attach_resource_to_component return unless resource.persisted? @component.resource = resource @@ -17,10 +19,10 @@ end def load_and_authorize_form loader = self.class.cancan_resource_class.new( self, :resource, parent: false, class: resource_model.name, - singleton: true, through: :component + singleton: true, through: :component, bypass_params_assignation: true ) loader.load_and_authorize_resource instance_variable_set(:"@#{ resource_name }", @resource) end