Module: Slingshot::Model::Search
- Extended by:
- ClassMethods
- Defined in:
- lib/slingshot/model/search.rb
Defined Under Namespace
Modules: ClassMethods, InstanceMethods
Class Method Summary collapse
Methods included from ClassMethods
Class Method Details
.included(base) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/slingshot/model/search.rb', line 6 def self.included(base) base.class_eval do extend Slingshot::Model::Naming::ClassMethods include Slingshot::Model::Naming::InstanceMethods extend Slingshot::Model::Indexing::ClassMethods extend Slingshot::Model::Import::ClassMethods extend ClassMethods include InstanceMethods ['_score', '_type', '_index', '_version', 'sort', 'highlight'].each do |attr| # TODO: Find a sane way to add attributes like _score for ActiveRecord - # `define_attribute_methods [attr]` does not work in AR. define_method("#{attr}=") { |value| @attributes ||= {}; @attributes[attr] = value } define_method("#{attr}") { @attributes[attr] } end end end |