aboutsummaryrefslogtreecommitdiffstats
path: root/app/controllers/exports_controller.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/controllers/exports_controller.rb')
-rw-r--r--app/controllers/exports_controller.rb15
1 files changed, 9 insertions, 6 deletions
diff --git a/app/controllers/exports_controller.rb b/app/controllers/exports_controller.rb
index d56b14fb2..3a91217e4 100644
--- a/app/controllers/exports_controller.rb
+++ b/app/controllers/exports_controller.rb
@@ -8,18 +8,21 @@ class ExportsController < ChouetteController
private
def build_resource
- @export ||= Export::Workbench.new(*resource_params) do |export|
+ Export::Base.force_load_descendants if Rails.env.development?
+ @export ||= Export::Base.new(*resource_params) do |export|
export.workbench = parent
export.creator = current_user.name
end
+ @export
end
def export_params
- params.require(:export).permit(
- :name,
- :type,
- :referential_id
- )
+ permitted_keys = %i(name type referential_id)
+ export_class = params[:export] && params[:export][:type].safe_constantize
+ if export_class
+ permitted_keys += export_class.options.keys
+ end
+ params.require(:export).permit(permitted_keys)
end
def decorate_collection(exports)