Class: Engine2::StarToManyBulkUnlinkMeta

Inherits:
StarToManyUnlinkMetaBase show all
Defined in:
lib/engine2/meta/link_meta.rb

Instance Attribute Summary

Attributes inherited from Meta

#action, #assets, #invokable, #static

Instance Method Summary collapse

Methods inherited from StarToManyUnlinkMetaBase

#many_to_many_unlink_db, many_to_many_unlink_db, one_to_many_unlink_db, #one_to_many_unlink_db

Methods included from MetaModelSupport

#action_defined, #get_type_info, #hide_pk, #show_pk, #unsupported_association

Methods inherited from Meta

#action_defined, #check_static_meta, #dynamic?, #freeze_meta, #get, http_method, #http_method, inherited, #initialize, #invoke!, #lookup, #merge, #meta_type, meta_type, #post_process, #post_run, #request, #request_meta_proc_params, #response, #split_keys

Constructor Details

This class inherits a constructor from Engine2::Meta

Instance Method Details

#invoke(handler) ⇒ Object



119
120
121
122
123
124
125
126
127
128
129
130
131
# File 'lib/engine2/meta/link_meta.rb', line 119

def invoke handler
    ids = handler.param_to_json(:ids)
    handler.permit ids.is_a?(Array)
    assoc = assets[:assoc]
    case assoc[:type]
    when :one_to_many
        one_to_many_unlink_db(handler, ids)
    when :many_to_many
        handler.permit parent = handler.params[:parent_id]
        many_to_many_unlink_db(parent, ids)
    else unsupported_association
    end
end

#pre_runObject



114
115
116
117
# File 'lib/engine2/meta/link_meta.rb', line 114

def pre_run
    super
    action.parent.parent.*.menu(:menu).option_after :default_order, :confirm_bulk_unlink, icon: "minus", show: "action.selected_size() > 0", button_loc: false
end