Module: Undercarriage::Controllers::ActionConcern
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/undercarriage/controllers/action_concern.rb
Overview
Action helpers
Helpers for the controller or view to help identify the action
Instance Method Summary collapse
-
#action?(action_method) ⇒ Boolean
Check action.
-
#collection_action? ⇒ Boolean
Check if collection.
-
#create_action? ⇒ Boolean
Check if create.
-
#create_actions? ⇒ Boolean
(also: #new_actions?)
Check if create or new.
-
#destroy_action? ⇒ Boolean
Check if destroy.
-
#edit_action? ⇒ Boolean
Check if edit.
-
#index_action? ⇒ Boolean
Check if index.
-
#member_action? ⇒ Boolean
Check if member.
-
#new_action? ⇒ Boolean
Check if new.
-
#show_action? ⇒ Boolean
Check if show.
-
#update_action? ⇒ Boolean
Check if update.
-
#update_actions? ⇒ Boolean
(also: #edit_actions?)
Check if edit or update.
Instance Method Details
#action?(action_method) ⇒ Boolean
Check action
Check if action is a certain action type
48 49 50 |
# File 'lib/undercarriage/controllers/action_concern.rb', line 48 def action?(action_method) action == action_method.to_sym end |
#collection_action? ⇒ Boolean
Check if collection
Check if action is a collection action type. An action is a collection type if it is the index action
160 161 162 |
# File 'lib/undercarriage/controllers/action_concern.rb', line 160 def collection_action? collection_actions.include?(action) end |
#create_action? ⇒ Boolean
Check if create
Check if action is the create action type. The check will pass if it is a create action
104 105 106 |
# File 'lib/undercarriage/controllers/action_concern.rb', line 104 def create_action? action?("create") end |
#create_actions? ⇒ Boolean Also known as: new_actions?
Check if create or new
Check if action is a create or new action type. The check will pass if it is a create or new action
177 178 179 |
# File 'lib/undercarriage/controllers/action_concern.rb', line 177 def create_actions? create_actions.include?(action) end |
#destroy_action? ⇒ Boolean
Check if destroy
Check if action is the destroy action type. The check will pass if it is a destroy action
146 147 148 |
# File 'lib/undercarriage/controllers/action_concern.rb', line 146 def destroy_action? action?("destroy") end |
#edit_action? ⇒ Boolean
Check if edit
Check if action is the edit action type. The check will pass if it is an edit action
118 119 120 |
# File 'lib/undercarriage/controllers/action_concern.rb', line 118 def edit_action? action?("edit") end |
#index_action? ⇒ Boolean
Check if index
Check if action is the index action type. The check will pass if it is an index action
62 63 64 |
# File 'lib/undercarriage/controllers/action_concern.rb', line 62 def index_action? action?("index") end |
#member_action? ⇒ Boolean
Check if member
Check if action is a member action type. An action is a member type if it is the edit, show, or update
action
193 194 195 |
# File 'lib/undercarriage/controllers/action_concern.rb', line 193 def member_action? member_actions.include?(action) end |
#new_action? ⇒ Boolean
Check if new
Check if action is the new action type. The check will pass if it is a new action
90 91 92 |
# File 'lib/undercarriage/controllers/action_concern.rb', line 90 def new_action? action?("new") end |
#show_action? ⇒ Boolean
Check if show
Check if action is the show action type. The check will pass if it is a show action
76 77 78 |
# File 'lib/undercarriage/controllers/action_concern.rb', line 76 def show_action? action?("show") end |
#update_action? ⇒ Boolean
Check if update
Check if action is the update action type. The check will pass if it is an update action
132 133 134 |
# File 'lib/undercarriage/controllers/action_concern.rb', line 132 def update_action? action?("update") end |
#update_actions? ⇒ Boolean Also known as: edit_actions?
Check if edit or update
Check if action is an edit or update action type. The check will pass if it is an edit or update action
210 211 212 |
# File 'lib/undercarriage/controllers/action_concern.rb', line 210 def update_actions? update_actions.include?(action) end |