module Engine2::ActionCreateSupport

Public Class Methods

included(action) click to toggle source
# File lib/engine2/action.rb, line 1056
def self.included action
    action.action_type :create
end

Public Instance Methods

create_record(handler, record) click to toggle source
# File lib/engine2/action.rb, line 1072
def create_record handler, record
end
invoke(handler) click to toggle source
# File lib/engine2/action.rb, line 1075
def invoke handler
    record = {}
    # if assoc = assets[:assoc]
    #     case assoc[:type]
    #     when :one_to_many
    #         parent = handler.params[:parent_id]
    #         assoc[:keys].zip(split_keys(parent)).each{|key, val| record[key] = val} if parent
    #     end
    # end
    static.record(handler, record)
    {record: record, new: true}
end
pre_run() click to toggle source
Calls superclass method Engine2::ActionFormSupport#pre_run
# File lib/engine2/action.rb, line 1060
def pre_run
    super
    panel_title "#{LOCS[:create_title]} - #{LOCS[assets[:model].table_name]}"
    node.parent.*.menu(:menu).option_at 0, node.name, icon: "plus-sign", button_loc: false if node.parent.*.is_a?(ActionListSupport)

    hide_pk unless assets[:model].natural_key
end
record(handler, record) click to toggle source
# File lib/engine2/action.rb, line 1068
def record handler, record
    create_record(handler, record)
end