Class: Decidim::Plans::ApplicationController
- Inherits:
-
Components::BaseController
- Object
- Components::BaseController
- Decidim::Plans::ApplicationController
show all
- Defined in:
- app/controllers/decidim/plans/application_controller.rb
Overview
This controller is the abstract class from which all other controllers of this engine inherit.
Note that it inherits from ‘Decidim::Components::BaseController`, which override its layout and provide all kinds of useful methods.
Instance Method Summary
collapse
Instance Method Details
#plan_limit ⇒ Object
14
15
16
17
|
# File 'app/controllers/decidim/plans/application_controller.rb', line 14
def plan_limit
return nil if component_settings.plan_limit.zero?
component_settings.plan_limit
end
|
#plan_limit_reached? ⇒ Boolean
19
20
21
22
23
|
# File 'app/controllers/decidim/plans/application_controller.rb', line 19
def plan_limit_reached?
return false unless plan_limit
plans.where(author: current_user).count >= plan_limit
end
|
#plans ⇒ Object
25
26
27
|
# File 'app/controllers/decidim/plans/application_controller.rb', line 25
def plans
Plan.where(component: current_component)
end
|