aboutsummaryrefslogtreecommitdiffstats
path: root/app/models/user.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/user.rb')
-rw-r--r--app/models/user.rb3
1 files changed, 2 insertions, 1 deletions
diff --git a/app/models/user.rb b/app/models/user.rb
index 14ab478a8..5a2e4d3ca 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -15,7 +15,6 @@ class User < ActiveRecord::Base
# Setup accessible (or protected) attributes for your model
# attr_accessible :email, :password, :current_password, :password_confirmation, :remember_me, :name, :organisation_attributes
belongs_to :organisation
-
accepts_nested_attributes_for :organisation
validates :organisation, :presence => true
@@ -28,6 +27,8 @@ class User < ActiveRecord::Base
end
after_destroy :check_destroy_organisation
+ scope :with_organisation, -> { where.not(organisation_id: nil) }
+
def self.destructive_permissions_for(models)
models.product( %w{create destroy update} ).map{ |model_action| model_action.join('.') }
end