Module: LiveFront::ApplicationHelper
- Defined in:
- lib/live-front/application_helper.rb
Instance Method Summary collapse
-
#current_action?(*args) ⇒ Boolean
Check if a particular action is the current one.
-
#current_controller?(*args) ⇒ Boolean
Check if a particular controller is the current one.
Instance Method Details
#current_action?(*args) ⇒ Boolean
Check if a particular action is the current one
args - One or more action names to check
Examples
# On Projects#new
current_action?(:new) # => true
current_action?(:create) # => false
current_action?(:new, :create) # => true
27 28 29 |
# File 'lib/live-front/application_helper.rb', line 27 def current_action?(*args) args.any? { |v| v.to_s.downcase == action_name } end |
#current_controller?(*args) ⇒ Boolean
Check if a particular controller is the current one
args - One or more controller names to check
Examples
# On TreeController
current_controller?(:tree) # => true
current_controller?(:commits) # => false
current_controller?(:commits, :tree) # => true
13 14 15 |
# File 'lib/live-front/application_helper.rb', line 13 def current_controller?(*args) args.any? { |v| v.to_s.downcase == controller.controller_name } end |