Class: Redpear::Schema::Index

Inherits:
Column
  • Object
show all
Defined in:
lib/redpear/schema/index.rb

Direct Known Subclasses

Score

Instance Attribute Summary

Attributes inherited from Column

#model, #type

Instance Method Summary collapse

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.

Parameters:

Returns:



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`.

Parameters:

  • value (String)

    index value

Returns:



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