Class: ActiveRecord::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/postgres_sequence_support.rb

Class Method Summary collapse

Class Method Details

.current_idObject


12
13
14
# File 'lib/postgres_sequence_support.rb', line 12

def self.current_id
  connection.current_in_sequence(id_sequence)
end

.id_sequenceObject


3
4
5
# File 'lib/postgres_sequence_support.rb', line 3

def self.id_sequence
  connection.default_sequence_name
end

.last_idObject


16
17
18
# File 'lib/postgres_sequence_support.rb', line 16

def self.last_id
  connection.current_in_sequence(id_sequence)
end

.next_idObject

Returns the next id on the table's id sequence.


8
9
10
# File 'lib/postgres_sequence_support.rb', line 8

def self.next_id
  connection.next_in_sequence(id_sequence)
end