diff options
| author | Zog | 2018-03-08 11:46:20 +0100 |
|---|---|---|
| committer | Zog | 2018-03-12 12:00:14 +0100 |
| commit | a4a075f5eec935dd6a0dbf0a861b6ada13b1dcbc (patch) | |
| tree | b046d69937ce998d918a7a4bf5a3e2e418961fa1 /app/controllers | |
| parent | db15dc6158939d2577ccd53aac66a283ce4f3338 (diff) | |
| download | chouette-core-a4a075f5eec935dd6a0dbf0a861b6ada13b1dcbc.tar.bz2 | |
Refs #6133; Add options on the Exports, and forward them tu the UX
Diffstat (limited to 'app/controllers')
| -rw-r--r-- | app/controllers/exports_controller.rb | 15 |
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) |
