Module: Escargot::HitExtensions

Defined in:
lib/escargot/elasticsearch_ex.rb

Instance Method Summary collapse

Instance Method Details

#to_activerecordObject



53
54
55
56
57
58
59
60
# File 'lib/escargot/elasticsearch_ex.rb', line 53

def to_activerecord
  model_class = _type.gsub(/-/,'/').classify.constantize
  begin
    model_class.find(id) 
  rescue ActiveRecord::RecordNotFound
    nil
  end
end