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
|
4115
db/schema.rb
4115
db/schema.rb
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue