aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--app/controllers/referentials_controller.rb8
-rw-r--r--app/models/referential.rb1
2 files changed, 9 insertions, 0 deletions
diff --git a/app/controllers/referentials_controller.rb b/app/controllers/referentials_controller.rb
index 6ee744413..8881c5127 100644
--- a/app/controllers/referentials_controller.rb
+++ b/app/controllers/referentials_controller.rb
@@ -6,6 +6,10 @@ class ReferentialsController < InheritedResources::Base
show!
end
+ def create
+ create!
+ end
+
protected
def resource
@referential ||= current_organisation.referentials.find_by_id(params[:id])
@@ -13,5 +17,9 @@ class ReferentialsController < InheritedResources::Base
def collection
@referentials ||= current_organisation.referentials
end
+ def create_resource(referential)
+ referential.organisation = current_organisation
+ referential
+ end
end
diff --git a/app/models/referential.rb b/app/models/referential.rb
index b87ba81e8..ab4290cdd 100644
--- a/app/models/referential.rb
+++ b/app/models/referential.rb
@@ -22,6 +22,7 @@ class Referential < ActiveRecord::Base
has_many :exports, :dependent => :destroy
belongs_to :organisation
+ validates_presence_of :organisation
def slug_excluded_values
if ! slug.nil?