Class: Decidim::DecidimAwesome::AwesomeConfig
- Inherits:
-
ApplicationRecord
- Object
- ActiveRecord::Base
- ApplicationRecord
- Decidim::DecidimAwesome::AwesomeConfig
- Defined in:
- app/models/decidim/decidim_awesome/awesome_config.rb
Class Method Summary collapse
Instance Method Summary collapse
- #add_constraints(constraints) ⇒ Object
- #additional_constraints ⇒ Object
-
#all_constraints ⇒ Object
use this instead of “constraints” to evaluate dynamically added constants.
Class Method Details
.for_organization(organization) ⇒ Object
27 28 29 |
# File 'app/models/decidim/decidim_awesome/awesome_config.rb', line 27 def self.for_organization(organization) where(organization:) end |
Instance Method Details
#add_constraints(constraints) ⇒ Object
21 22 23 24 25 |
# File 'app/models/decidim/decidim_awesome/awesome_config.rb', line 21 def add_constraints(constraints) return if constraints.blank? additional_constraints.concat(constraints.respond_to?(:each) ? constraints : [constraints]) end |
#additional_constraints ⇒ Object
17 18 19 |
# File 'app/models/decidim/decidim_awesome/awesome_config.rb', line 17 def additional_constraints @additional_constraints ||= [] end |
#all_constraints ⇒ Object
use this instead of “constraints” to evaluate dynamically added constants
32 33 34 |
# File 'app/models/decidim/decidim_awesome/awesome_config.rb', line 32 def all_constraints constraints + additional_constraints end |