Module: Elastic::Types::NestableType
- Included in:
- Elastic::Type
- Defined in:
- lib/elastic/types/nestable_type.rb
Instance Method Summary collapse
Instance Method Details
#nested(_name, using: nil, target: nil, &_block) ⇒ Object
3 4 5 6 7 8 9 10 11 12 |
# File 'lib/elastic/types/nestable_type.rb', line 3 def nested(_name, using: nil, target: nil, &_block) unless _block.nil? using = Class.new(Elastic::NestedType, &_block) using.target = (target || _name.to_s.singularize.camelize.constantize) rescue nil end using = (_name.to_s.singularize + '_index').camelize.constantize if using.nil? pre_definition.register_field Elastic::Fields::Nested.new(_name, using) end |