summaryrefslogtreecommitdiff
path: root/app/models/permission.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/permission.rb')
-rw-r--r--app/models/permission.rb6
1 files changed, 3 insertions, 3 deletions
diff --git a/app/models/permission.rb b/app/models/permission.rb
index 438538e..1383a4b 100644
--- a/app/models/permission.rb
+++ b/app/models/permission.rb
@@ -1,4 +1,4 @@
1class Permission < ActiveRecord::Base 1class Permission < ApplicationRecord
2 # Validations 2 # Validations
3 validates_presence_of :user_id, :node_id, :granted 3 validates_presence_of :user_id, :node_id, :granted
4 validates_inclusion_of :granted, :in => [true, false] 4 validates_inclusion_of :granted, :in => [true, false]
@@ -8,6 +8,6 @@ class Permission < ActiveRecord::Base
8 belongs_to :node 8 belongs_to :node
9 9
10 # Named scopes 10 # Named scopes
11 named_scope :for_node, lambda { |node| { :conditions => ['node_id = ?', (node.is_a? Node ? node.id : node)] } } 11 scope :for_node, ->(node) { where('node_id = ?', (node.is_a?(Node) ? node.id : node)) }
12 named_scope :for_user, lambda { |user| { :conditions => ['user_id = ?', (user.is_a? User ? user.id : user)] } } 12 scope :for_user, ->(user) { where('user_id = ?', (user.is_a?(User) ? user.id : user)) }
13end 13end