gem 'tire', '~> 0.4.1'
Bonsai provisions one ElasticSearch index per application. Tire, however, assumes that each model is using its own index.
Currently the best way to work around this is to set the Tire.configuration.url
and the model's index_name
manually.
if ENV['BONSAI_INDEX_URL']
Tire.configure do
url "http://index.bonsai.io"
end
BONSAI_INDEX_NAME = ENV['BONSAI_INDEX_URL'][/[^\/]+$/]
else
app_name = Rails.application.class.parent_name.underscore.dasherize
app_env = Rails.env
BONSAI_INDEX_NAME = "#{app_name}-#{app_env}"
end
class Article
include Tire::Model::Search
include Tire::Model::Callbacks
index_name BONSAI_INDEX_NAME
end
@mhenrixon — fyi, just updated the original gist for some changes deployed today.