fixing issue with elasticsearch option false in dev

This commit is contained in:
Shiho Takagi
2015-02-02 18:40:24 +11:00
parent ca47127197
commit 656b0e44d8
3 changed files with 3 additions and 3 deletions

View File

@@ -1,5 +1,5 @@
class AlternateName < ActiveRecord::Base
after_commit { |an| an.crop.__elasticsearch__.index_document if an.crop }
after_commit { |an| an.crop.__elasticsearch__.index_document if an.crop && ENV['GROWSTUFF_ELASTICSEARCH'] == "true" }
belongs_to :crop
belongs_to :creator, :class_name => 'Member'
end

View File

@@ -85,7 +85,7 @@ class Crop < ActiveRecord::Base
end
def update_index(name_obj)
__elasticsearch__.index_document
__elasticsearch__.index_document if ENV['GROWSTUFF_ELASTICSEARCH'] == "true"
end
####################################

View File

@@ -1,5 +1,5 @@
class ScientificName < ActiveRecord::Base
after_commit { |sn| sn.crop.__elasticsearch__.index_document if sn.crop }
after_commit { |sn| sn.crop.__elasticsearch__.index_document if sn.crop && ENV['GROWSTUFF_ELASTICSEARCH'] == "true" }
belongs_to :crop
belongs_to :creator, :class_name => 'Member'
end