Method: Elasticsearch::Model::Adapter.from_class

Defined in:
lib/elasticsearch/model/adapter.rb

.from_class(klass) ⇒ Object

Returns an adapter based on the Ruby class passed

Examples:

Create an adapter for an ActiveRecord-based model

class Article < ActiveRecord::Base; end

myadapter = Elasticsearch::Model::Adapter.from_class(Article)
myadapter.adapter
# => Elasticsearch::Model::Adapter::ActiveRecord

See Also:

[View source]

44
45
46
# File 'lib/elasticsearch/model/adapter.rb', line 44

def from_class(klass)
  Adapter.new(klass)
end