diff options
| author | Xinhui | 2017-07-07 16:04:00 +0200 |
|---|---|---|
| committer | Xinhui | 2017-07-07 16:04:38 +0200 |
| commit | c427e5f8b87e715335c91a47f5fd9e0e09234048 (patch) | |
| tree | 948501e0e3533e8414bcce8c7882a14358165bd5 /app/models/user.rb | |
| parent | 6f06b32a423abe8fb6ae7e69589eaa72d5dfe728 (diff) | |
| download | chouette-core-c427e5f8b87e715335c91a47f5fd9e0e09234048.tar.bz2 | |
Refactoring calendar mailer move users query into observer
Diffstat (limited to 'app/models/user.rb')
| -rw-r--r-- | app/models/user.rb | 3 |
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 |
