diff options
| author | Michel Etienne | 2012-09-03 16:38:08 +0200 |
|---|---|---|
| committer | Michel Etienne | 2012-09-03 16:38:08 +0200 |
| commit | df33fee5452c94eaf55ead124fb0ed2cb6690ef6 (patch) | |
| tree | 28cb14c806e157b3475dda1f91808a81e069686a | |
| parent | 8947fae26d69b4380075a1f82376174fa81cb695 (diff) | |
| download | chouette-core-df33fee5452c94eaf55ead124fb0ed2cb6690ef6.tar.bz2 | |
organisation mandatory for referentials
| -rw-r--r-- | app/controllers/referentials_controller.rb | 8 | ||||
| -rw-r--r-- | app/models/referential.rb | 1 |
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? |
