Module: Engine2::ActionOnChangeSupport

Included in:
ActionFormSupport, ActionListSupport
Defined in:
lib/engine2/action.rb

Defined Under Namespace

Classes: OnChangeAction, OnChangeGetAction, OnChangePostAction

Instance Method Summary collapse

Instance Method Details

#on_change(field, &blk) ⇒ Object



589
590
591
592
593
594
595
596
# File 'lib/engine2/action.rb', line 589

def on_change field, &blk
    node_name = :"#{field}_on_change"
    nd = node.define_node node_name, (blk.arity > 2 ? OnChangeGetAction : OnChangePostAction)
    nd.*{request &blk}

    fields! field, remote_onchange: node_name
    fields! field, remote_onchange_record: :true if blk.arity > 2
end