Class: Redpear::Schema::Index
- Defined in:
- lib/redpear/schema/index.rb
Direct Known Subclasses
Instance Attribute Summary
Attributes inherited from Column
Instance Method Summary collapse
-
#for(record) ⇒ Redpear::Store::Set
The set holding the IDs for ‘record’s` index.
-
#members(value) ⇒ Redpear::Store::Set
The set holding the IDs for the given ‘foreign_key`.
Methods inherited from Column
#encode_value, #initialize, #name, #readable?, #type_cast, #writable?
Constructor Details
This class inherits a constructor from Redpear::Schema::Column
Instance Method Details
#for(record) ⇒ Redpear::Store::Set
Returns the set holding the IDs for ‘record’s` index.
5 6 7 |
# File 'lib/redpear/schema/index.rb', line 5 def for(record) members record.send(name) end |
#members(value) ⇒ Redpear::Store::Set
Returns the set holding the IDs for the given ‘foreign_key`.
11 12 13 14 |
# File 'lib/redpear/schema/index.rb', line 11 def members(value) value = '_' if value.nil? Redpear::Store::Set.new nested_key(name, value), model.connection end |