Module: DataMapper::Adapters::Sphinx::Resource
- Defined in:
- lib/dm-sphinx-adapter/resource.rb
Overview
Declare Sphinx indexes and attributes in your resource.
model Items
include DataMapper::SphinxResource
# .. normal properties and such for :default
repository(:search) do
# Query some_index, some_index_delta in that order.
index :some_index
index :some_index_delta, :delta => true
# Sortable by some attributes.
attribute :updated_at, DateTime # sql_attr_timestamp
attribute :age, Integer # sql_attr_uint
attribute :deleted, Boolean # sql_attr_bool
end
end
Defined Under Namespace
Modules: ClassMethods
Class Method Summary collapse
- .append_inclusions(*inclusions) ⇒ Object
- .extra_inclusions ⇒ Object
-
.included(model) ⇒ Object
:nodoc:.
Class Method Details
.append_inclusions(*inclusions) ⇒ Object
25 26 27 28 |
# File 'lib/dm-sphinx-adapter/resource.rb', line 25 def self.append_inclusions(*inclusions) extra_inclusions.concat inclusions true end |
.extra_inclusions ⇒ Object
30 31 32 |
# File 'lib/dm-sphinx-adapter/resource.rb', line 30 def self.extra_inclusions @extra_inclusions ||= [] end |
.included(model) ⇒ Object
:nodoc:
34 35 36 37 38 |
# File 'lib/dm-sphinx-adapter/resource.rb', line 34 def self.included(model) #:nodoc: model.send(:include, DataMapper::Resource) model.extend ClassMethods if defined?(ClassMethods) extra_inclusions.each{|inclusion| model.send(:include, inclusion)} end |