Class: Engine2::DecodeMeta
- Includes:
- MetaAPISupport, MetaModelSupport, MetaQuerySupport
- Defined in:
- lib/engine2/meta/decode_meta.rb
Direct Known Subclasses
Instance Attribute Summary
Attributes inherited from Meta
#action, #assets, #invokable, #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 MetaAPISupport
#config, #decorate, #field_filter, #hide_fields, #info, #info!, #loc!, #reload_routes!, #render, #show_fields
Methods included from MetaModelSupport
#action_defined, #get_type_info, #hide_pk, #show_pk, #unsupported_association
Methods included from MetaQuerySupport
#find_record, #get_query, #query, #select
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, #request, #request_meta_proc_params, #split_keys
Constructor Details
This class inherits a constructor from Engine2::Meta
Instance Method Details
#decode(*fields, &blk) ⇒ Object
7 8 9 10 |
# File 'lib/engine2/meta/decode_meta.rb', line 7 def decode *fields, &blk query select(*fields), &blk [:decode_fields] = fields end |
#post_process ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/engine2/meta/decode_meta.rb', line 20 def post_process if fields = [:fields] fields = fields - static.get[:fields] 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
44 45 46 47 48 49 |
# File 'lib/engine2/meta/decode_meta.rb', line 44 def post_run query select(*assets[:model].primary_keys) unless @query [:separator] = '/' unless [:separator] super [:primary_fields] = assets[:model].primary_keys end |
#pre_run ⇒ Object
33 34 35 36 37 38 39 40 41 42 |
# File 'lib/engine2/meta/decode_meta.rb', line 33 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 [:decode_selected] = LOCS[:decode_selected] end end end |
#separator(sep) ⇒ Object
12 13 14 |
# File 'lib/engine2/meta/decode_meta.rb', line 12 def separator sep [:separator] = sep end |
#show_max_selected(max) ⇒ Object
16 17 18 |
# File 'lib/engine2/meta/decode_meta.rb', line 16 def show_max_selected max [:show_max_selected] = max end |