You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

elasticsearch_dev_patch.rb 1.1 kB

​
​
​
​
​
​
​
​
​
​
​
10 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
10 years ago
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. #coding=utf-8
  2. # elasticsearch 在开发环境下也要打开,很烦人的
  3. if Rails.env.development?
  4. require 'elasticsearch/model'
  5. module Elasticsearch
  6. module Model
  7. class NoObject
  8. instance_methods.each do |m|
  9. undef_method(m) unless [:object_id, :__send__, :undef_method, :method_missing].include?(m)
  10. end
  11. def method_missing(method, *args, &block)
  12. puts "NoObject #{method} #{args}"
  13. end
  14. def NoObject.included(mod)
  15. puts "#{self} included in #{mod}"
  16. end
  17. def self.extended(mod)
  18. puts "#{self} extended in #{mod}"
  19. end
  20. def initialize
  21. puts methods
  22. end
  23. end
  24. def self.included(base)
  25. base.instance_eval do
  26. def settings(a)
  27. end
  28. def __elasticsearch__
  29. @__elasticsearch__ ||= NoObject.new
  30. end
  31. end
  32. base.class_eval do
  33. def __elasticsearch__
  34. @__elasticsearch__ ||= NoObject.new
  35. end
  36. end
  37. end
  38. end
  39. end
  40. end

软件技术创新是当今国家整体创新能力的重要基础和发展引擎。近年来,大众参与的软件创新与创业活动已经成为网络时代软件开发和应用的新形态,正在快速改变着全球软件创新模式和软件产业格局。 ...