elasticsearch在开发环境下的补丁,默认不开启
This commit is contained in:
parent
da81fb533e
commit
bb0ff4a14c
|
@ -0,0 +1,53 @@
|
|||
#coding=utf-8
|
||||
|
||||
# elasticsearch 在开发环境下也要打开,很烦人的
|
||||
|
||||
if Rails.env.development?
|
||||
|
||||
require 'elasticsearch/model'
|
||||
module Elasticsearch
|
||||
module Model
|
||||
class NoObject
|
||||
|
||||
instance_methods.each do |m|
|
||||
undef_method(m) unless [:undef_method, :method_missing].include?(m)
|
||||
end
|
||||
|
||||
def method_missing(method, *args, &block)
|
||||
puts "NoObject #{method} #{args}"
|
||||
end
|
||||
|
||||
def NoObject.included(mod)
|
||||
puts "#{self} included in #{mod}"
|
||||
end
|
||||
|
||||
def self.extended(mod)
|
||||
puts "#{self} extended in #{mod}"
|
||||
end
|
||||
|
||||
def initialize
|
||||
puts methods
|
||||
end
|
||||
end
|
||||
|
||||
def self.included(base)
|
||||
base.instance_eval do
|
||||
def settings(a)
|
||||
end
|
||||
|
||||
def __elasticsearch__
|
||||
@__elasticsearch__ ||= NoObject.new
|
||||
end
|
||||
end
|
||||
|
||||
base.class_eval do
|
||||
def __elasticsearch__
|
||||
@__elasticsearch__ ||= NoObject.new
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
end
|
|
@ -1373,7 +1373,6 @@ ActiveRecord::Schema.define(:version => 20160128024452) do
|
|||
t.integer "changeset_num", :default => 0
|
||||
t.integer "board_message_num", :default => 0
|
||||
t.integer "board_num", :default => 0
|
||||
t.integer "act_num", :default => 0
|
||||
t.integer "attach_num", :default => 0
|
||||
t.datetime "commit_time"
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue