aboutsummaryrefslogtreecommitdiffstats
path: root/app/controllers
diff options
context:
space:
mode:
authorXinhui2016-10-24 15:24:02 +0200
committerXinhui2016-10-24 15:24:02 +0200
commit45c6a1a9d775546e5543bf7bfb2dffd485bf1f0a (patch)
tree210ab85be8c71940fc65a2264de10e67d3508f71 /app/controllers
parent2df352163e6987c93273df27e46ad6b07cff8a68 (diff)
downloadchouette-core-45c6a1a9d775546e5543bf7bfb2dffd485bf1f0a.tar.bz2
Referential new_from method
Refs #1863
Diffstat (limited to 'app/controllers')
-rw-r--r--app/controllers/referentials_controller.rb8
1 files changed, 7 insertions, 1 deletions
diff --git a/app/controllers/referentials_controller.rb b/app/controllers/referentials_controller.rb
index 4ffb6ad65..3ae59f975 100644
--- a/app/controllers/referentials_controller.rb
+++ b/app/controllers/referentials_controller.rb
@@ -7,6 +7,7 @@ class ReferentialsController < BreadcrumbController
respond_to :js, :only => :show
def new
+ @referential = Referential.new_from(Referential.find(params[:from])) if params[:from]
new! do
@referential.data_format = current_organisation.data_format
end
@@ -56,7 +57,11 @@ class ReferentialsController < BreadcrumbController
end
def create_resource(referential)
- referential.organisation = current_organisation
+ if referential.created_from
+ referential.clone_association referential.created_from
+ else
+ referential.organisation = current_organisation
+ end
super
end
@@ -74,6 +79,7 @@ class ReferentialsController < BreadcrumbController
:projection_type,
:data_format,
:archived_at,
+ :created_from_id,
referential_metadata_attributes: [:referential_source_id, :line_ids => []]
)
end