aboutsummaryrefslogtreecommitdiffstats
path: root/app/controllers
diff options
context:
space:
mode:
authorAlban Peignier2017-03-21 09:40:10 +0100
committerAlban Peignier2017-03-21 11:16:04 +0100
commitadff72c7c3f257d315e55208df97868c0a1db898 (patch)
treeb2dcd0114d5b214e1a16b9a060a3727d35d2e975 /app/controllers
parente4401a05faa153f202b407718757316ae23c397b (diff)
downloadchouette-core-adff72c7c3f257d315e55208df97868c0a1db898.tar.bz2
Find Referential in Organisation#find_referential. Use it in ReferentialSupport and ReferentialsController. Refs #2900
Diffstat (limited to 'app/controllers')
-rw-r--r--app/controllers/concerns/referential_support.rb14
-rw-r--r--app/controllers/referentials_controller.rb2
2 files changed, 3 insertions, 13 deletions
diff --git a/app/controllers/concerns/referential_support.rb b/app/controllers/concerns/referential_support.rb
index 34080d991..fe75e3579 100644
--- a/app/controllers/concerns/referential_support.rb
+++ b/app/controllers/concerns/referential_support.rb
@@ -16,17 +16,7 @@ module ReferentialSupport
end
def find_referential
- organisation_referential = current_organisation.referentials.find_by id: params[:referential_id]
- return organisation_referential if organisation_referential
-
- current_organisation.workbenches.each do |workbench|
- workbench_referential = workbench.all_referentials.find_by id: params[:referential_id]
- return workbench_referential if workbench_referential
- end
-
- raise ActiveRecord::RecordNotFound
+ current_organisation.find_referential params[:referential_id]
end
-end
-
-
+end
diff --git a/app/controllers/referentials_controller.rb b/app/controllers/referentials_controller.rb
index 9a9e9b151..ed20a6d17 100644
--- a/app/controllers/referentials_controller.rb
+++ b/app/controllers/referentials_controller.rb
@@ -73,7 +73,7 @@ class ReferentialsController < BreadcrumbController
def resource
- @referential ||= current_organisation.referentials.find_by_id(params[:id])
+ @referential ||= current_organisation.find_referential(params[:id])
end
def collection