Module: Ion::Entity::ClassMethods

Defined in:
lib/ion/entity.rb

Instance Method Summary collapse

Instance Method Details

#ion(&blk) ⇒ Object

Sets up Ion indexing for a model.

When no block is given, it returns the Ion::Options for the model.

Examples:


class Artist < Model
  include Ion::Entity
  ion {
    text :name
    text :real_name
  }
end

Artist.ion.indices
Artist.ion.search { ... }


42
43
44
45
46
# File 'lib/ion/entity.rb', line 42

def ion(&blk)
  @ion_options ||= Ion::Options.new(self)
  @ion_options.instance_eval(&blk)  if block_given?
  @ion_options
end