Module: ActiveScaffold::Actions::Nested::ChildMethods
- Defined in:
- lib/active_scaffold/actions/nested.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.include_habtm_actions(config) ⇒ Object
135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 |
# File 'lib/active_scaffold/actions/nested.rb', line 135 def self.include_habtm_actions(config) # Production mode is ok with adding a link everytime the scaffold is nested - we are not ok with that. unless config.action_links['new_existing'] config.action_links.add('new_existing', label: :add_existing, type: :collection, security_method: :add_existing_authorized?, ignore_method: :add_existing_ignore?) end return unless config.nested.shallow_delete unless config.action_links['destroy_existing'] config.action_links.add('destroy_existing', label: :remove, type: :member, confirm: :are_you_sure_to_delete, method: :delete, position: false, security_method: :add_existing_authorized?, ignore_method: :add_existing_ignore?) end config.action_links['destroy'].ignore_method = :habtm_delete_ignore? if config.actions.include?(:delete) end |
.included(base) ⇒ Object
130 131 132 133 |
# File 'lib/active_scaffold/actions/nested.rb', line 130 def self.included(base) super include_habtm_actions base.active_scaffold_config end |
Instance Method Details
#add_existing ⇒ Object
158 159 160 161 |
# File 'lib/active_scaffold/actions/nested.rb', line 158 def add_existing do_add_existing respond_to_action(:add_existing) end |
#destroy_existing ⇒ Object
163 164 165 166 167 168 |
# File 'lib/active_scaffold/actions/nested.rb', line 163 def destroy_existing return redirect_to(params.merge(action: :delete, only_path: true)) if request.get? || request.head? do_destroy_existing respond_to_action(:destroy_existing) end |
#new_existing ⇒ Object
153 154 155 156 |
# File 'lib/active_scaffold/actions/nested.rb', line 153 def new_existing do_new respond_to_action(:new_existing) end |