开发环境下不启动elastic

dev_blankdatabase
huang 9 years ago
parent 4f3b41f323
commit 1588f5cfca

@ -1254,12 +1254,14 @@ class Project < ActiveRecord::Base
def create_project_ealasticsearch_index def create_project_ealasticsearch_index
return if Rails.env.development?
if self.is_public if self.is_public
self.__elasticsearch__.index_document self.__elasticsearch__.index_document
end end
end end
def update_project_ealasticsearch_index def update_project_ealasticsearch_index
return if Rails.env.development?
if self.is_public #如果是初次更新成为公开的情况,会报错,那么这条记录尚未被索引过。没有报错就是更新的其他属性 if self.is_public #如果是初次更新成为公开的情况,会报错,那么这条记录尚未被索引过。没有报错就是更新的其他属性
begin begin
self.__elasticsearch__.update_document self.__elasticsearch__.update_document
@ -1276,6 +1278,7 @@ class Project < ActiveRecord::Base
end end
def delete_project_ealasticsearch_index def delete_project_ealasticsearch_index
return if Rails.env.development?
begin begin
self.__elasticsearch__.delete_document self.__elasticsearch__.delete_document
rescue => e rescue => e

Loading…
Cancel
Save