diff options
| author | erdgeist <erdgeist@erdgeist.org> | 2026-06-27 22:52:50 +0200 |
|---|---|---|
| committer | erdgeist <erdgeist@erdgeist.org> | 2026-06-27 22:52:50 +0200 |
| commit | 9a19a0494ef51cdac9a78e24d517ca48ba44c453 (patch) | |
| tree | 8eaae12d8047a40e29d3ea7ff3116b5c869e04bd /app/models/permission.rb | |
| parent | 85a01e35274b8d4d4165a7b26bd7986e211246bb (diff) | |
| parent | 1853082fcd8c067390c246f9daa01a9b47387497 (diff) | |
Migration from Rails 2.3.5 to Rails 8.1 successful.
Merging dev branch.
Diffstat (limited to 'app/models/permission.rb')
| -rw-r--r-- | app/models/permission.rb | 6 |
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 @@ | |||
| 1 | class Permission < ActiveRecord::Base | 1 | class 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)) } |
| 13 | end | 13 | end |
