Class: Decidim::Initiatives::UserAuthorizations
- Inherits:
-
Query
- Object
- Query
- Decidim::Initiatives::UserAuthorizations
- Defined in:
- app/queries/decidim/initiatives/user_authorizations.rb
Overview
Class used the retrieve the authorizations for a user.
Instance Attribute Summary collapse
-
#user ⇒ Object
readonly
Returns the value of attribute user.
Class Method Summary collapse
-
.for(user) ⇒ Object
Syntactic sugar to initialize the class and return the queried objects.
Instance Method Summary collapse
-
#initialize(user) ⇒ UserAuthorizations
constructor
Retrieves authorizations for the given user.
-
#query ⇒ Object
Retrieves authorizations for the given user.
Constructor Details
#initialize(user) ⇒ UserAuthorizations
Retrieves authorizations for the given user
user - Decidim::User
19 20 21 |
# File 'app/queries/decidim/initiatives/user_authorizations.rb', line 19 def initialize(user) @user = user end |
Instance Attribute Details
#user ⇒ Object (readonly)
Returns the value of attribute user.
7 8 9 |
# File 'app/queries/decidim/initiatives/user_authorizations.rb', line 7 def user @user end |
Class Method Details
.for(user) ⇒ Object
Syntactic sugar to initialize the class and return the queried objects.
user - Decidim::User
12 13 14 |
# File 'app/queries/decidim/initiatives/user_authorizations.rb', line 12 def self.for(user) new(user).query end |
Instance Method Details
#query ⇒ Object
Retrieves authorizations for the given user.
24 25 26 |
# File 'app/queries/decidim/initiatives/user_authorizations.rb', line 24 def query Authorization.where(user:).where.not(granted_at: nil) end |