-
Notifications
You must be signed in to change notification settings - Fork 898
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #18391 from agrare/bz_1668020_accessible_storages
Add method for restricting to accessible storages
- Loading branch information
Showing
5 changed files
with
19 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,16 @@ | ||
class HostStorage < ApplicationRecord | ||
belongs_to :host | ||
belongs_to :storage | ||
|
||
scope :writable, -> { where(:read_only => [nil, false]) } | ||
scope :read_only, -> { where(:read_only => true) } | ||
|
||
scope :accessible, -> { where(:accessible => [true, nil]) } | ||
scope :inaccessible, -> { where(:accessible => false) } | ||
|
||
class << self | ||
def writable_accessible | ||
writable.accessible | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters