Replace direct ES access with elasticsearch-model

This commit is contained in:
Andreas Haller 2015-04-27 21:26:37 +02:00
parent 5a07703166
commit 973af9f0d9
5 changed files with 18 additions and 9 deletions

View file

@ -1,6 +1,10 @@
require 'elasticsearch/model'
require 'json'
class Paper < ActiveRecord::Base
include Elasticsearch::Model
include Elasticsearch::Model::Callbacks
class << self
def import_from_json(json_string)
JSON.parse(json_string).each do |record|