Class: Decidim::Initiatives::InitiativesCreated
- Inherits:
-
Query
- Object
- Query
- Decidim::Initiatives::InitiativesCreated
- Defined in:
- app/queries/decidim/initiatives/initiatives_created.rb
Overview
Class uses to retrieve the initiatives created by the given user.
Instance Attribute Summary collapse
-
#user ⇒ Object
readonly
Returns the value of attribute user.
Class Method Summary collapse
-
.by(user) ⇒ Object
Syntactic sugar to initialize the class and return the queried objects.
Instance Method Summary collapse
-
#initialize(user) ⇒ InitiativesCreated
constructor
Initializes the class.
-
#query ⇒ Object
Retrieves the initiatives created by the given user.
Constructor Details
#initialize(user) ⇒ InitiativesCreated
Initializes the class.
user: Decidim::User
19 20 21 |
# File 'app/queries/decidim/initiatives/initiatives_created.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/initiatives_created.rb', line 7 def user @user end |
Class Method Details
.by(user) ⇒ Object
Syntactic sugar to initialize the class and return the queried objects.
user - Decidim::User
12 13 14 |
# File 'app/queries/decidim/initiatives/initiatives_created.rb', line 12 def self.by(user) new(user).query end |
Instance Method Details
#query ⇒ Object
Retrieves the initiatives created by the given user
24 25 26 |
# File 'app/queries/decidim/initiatives/initiatives_created.rb', line 24 def query Initiative.where(author: user) end |