Module: ActiveRecord::Sequence::ModelMethods

Defined in:
lib/active_record/sequence/model_methods.rb

Instance Method Summary collapse

Instance Method Details

#lastval(name) ⇒ Object



11
12
13
14
# File 'lib/active_record/sequence/model_methods.rb', line 11

def lastval(name)
  name = connection.quote_column_name(name)
  connection.query_value("SELECT lastval(#{name})")
end

#nextval(name) ⇒ Object



6
7
8
9
# File 'lib/active_record/sequence/model_methods.rb', line 6

def nextval(name)
  name = connection.quote_column_name(name)
  connection.query_value("SELECT nextval(#{name})")
end

#setval(name, value) ⇒ Object



16
17
18
19
# File 'lib/active_record/sequence/model_methods.rb', line 16

def setval(name, value)
  name = connection.quote_column_name(name)
  connection.query_value("SELECT setval(#{name}, #{value})")
end