Method: SearchFlip::Index::ClassMethods#record_id

Defined in:
lib/search_flip/index.rb

#record_id(record) ⇒ String, Fixnum

Returns the record’s id, ie the unique identifier or primary key of a record. Override this method for custom primary keys, but return a String or Fixnum.

Examples:

Default implementation

def self.record_id(record)
  record.id
end

Custom primary key

def self.record_id(user)
  user.username
end

Parameters:

  • record

    The record to get the primary key for

Returns:

  • (String, Fixnum)

    The record’s primary key



187
188
189
# File 'lib/search_flip/index.rb', line 187

def record_id(record)
  record.id
end