Skip to content

Instantly share code, notes, and snippets.

@mixtli
mixtli / gist:929866
Created April 19, 2011 22:22
postgres cti hacks
module ActiveRecord
module ConnectionAdapters
class PostgreSQLAdapter < AbstractAdapter
# For some reason, I have to override these two methods, or record ids don't get updated in
# the object after creating an object.
def prefetch_primary_key?(table_name = nil)
true
end
def next_sequence_value(sequence_name = nil)
query("SELECT nextval('#{sequence_name}')")[0][0]
require 'active_record'
# ClassTableInheritance is an ActiveRecord plugin designed to allow
# simple multiple table (class) inheritance.
class ActiveRecord::Base
attr_reader :reflection
def self.inherits_from(association_id)
# add an association, and set the foreign key.