Class: Engine2::DecodeAction
- Includes:
- ActionAPISupport, ActionModelSupport, ActionQuerySupport
- Defined in:
- lib/engine2/action/decode.rb
Direct Known Subclasses
Instance Attribute Summary
Attributes inherited from Action
#assets, #invokable, #meta, #node, #static
Instance Method Summary collapse
- #decode(*fields, &blk) ⇒ Object
- #post_process ⇒ Object
- #post_run ⇒ Object
- #pre_run ⇒ Object
- #separator(sep) ⇒ Object
- #show_max_selected(max) ⇒ Object
Methods included from ActionAPISupport
#config, #decorate, #field_filter, #fields, #fields!, #hide_fields, #loc!, #render, #show_fields
Methods included from ActionModelSupport
#hide_pk, #node_defined, #show_pk, #unsupported_association
Methods included from ActionQuerySupport
#find_record, #get_query, #query, #select
Methods inherited from Action
action_type, #action_type, #arguments, #check_anonymous_action_class, #check_static_action, #define_invoke, #define_method, #dynamic?, #execute, #freeze_action, #http_method, http_method, inherit, inherited, #initialize, #invoke!, #join_keys, #lookup, #merge, #node_defined, #repeat, #request, #request_action_proc_params, #split_keys
Constructor Details
This class inherits a constructor from Engine2::Action
Instance Method Details
#decode(*fields, &blk) ⇒ Object
8 9 10 11 |
# File 'lib/engine2/action/decode.rb', line 8 def decode *fields, &blk query select(*fields), &blk [:decode_fields] = fields end |
#post_process ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/engine2/action/decode.rb', line 21 def post_process if fields = [:field_list] fields = fields - static.[:field_list] if dynamic? # no decorate here fields.each do |name| type_info = assets[:model].type_info[name] # foreign keys ? proc = ListRendererPostProcessors[type_info[:type]] # like... checkboxes, list_selects proc.(self, name, type_info) if proc end end # no super end |
#post_run ⇒ Object
45 46 47 48 49 50 |
# File 'lib/engine2/action/decode.rb', line 45 def post_run decode(*assets[:model].primary_keys) unless @query [:separator] = '/' unless [:separator] super [:primary_fields] = assets[:model].primary_keys end |
#pre_run ⇒ Object
34 35 36 37 38 39 40 41 42 43 |
# File 'lib/engine2/action/decode.rb', line 34 def pre_run super if assoc = assets[:assoc] decode = assoc[:model].type_info[assoc[:keys].first][:decode] if decode[:search][:multiple] show_max_selected 3 loc! decode_selected: LOCS[:decode_selected] end end end |
#separator(sep) ⇒ Object
13 14 15 |
# File 'lib/engine2/action/decode.rb', line 13 def separator sep [:separator] = sep end |
#show_max_selected(max) ⇒ Object
17 18 19 |
# File 'lib/engine2/action/decode.rb', line 17 def show_max_selected max [:show_max_selected] = max end |