Created
November 22, 2010 03:36
-
-
Save matthewrudy/709480 to your computer and use it in GitHub Desktop.
an initializer for Rails 3, to fix compatability with postgres 9.0.1 and fixture loading when using foreign keys
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# HACK | |
# rails 3.0.3 doesn't turn off foreign keys on postgres 9.0.1 | |
# consider removing this after rails 3.0.4 | |
# https://rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets/5635-postgresql_adapter-doesnt-disable-referential-integrity-for-pg-90#ticket-5635-5 | |
require 'active_record/connection_adapters/postgresql_adapter' | |
module ActiveRecord | |
module ConnectionAdapters | |
class PostgreSQLAdapter < AbstractAdapter | |
# REFERENTIAL INTEGRITY ==================================== | |
# ### BREAKS FOR 9.0.1 | |
# def supports_disable_referential_integrity?() #:nodoc: | |
# version = query("SHOW server_version")[0][0].split('.') | |
# version[0].to_i >= 8 && version[1].to_i >= 1 | |
# rescue | |
# return false | |
# end | |
def supports_disable_referential_integrity? | |
postgresql_version >= 80100 | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment