Created
April 14, 2012 21:06
-
-
Save tuzz/2387871 to your computer and use it in GitHub Desktop.
A useful patch if you're subclassing AR 3.1.0-3.2.2
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
# Fixes dynamic find by method attempting to use the connection | |
# on ActiveRecord::Base in activerecord versions 3.1.0 to 3.2.2 | |
# when it should be respecting the connection on its subclass | |
class QuoteTableNamePatch | |
def self.quote_table_name(name) | |
name | |
end | |
end | |
module ActiveRecord | |
module Associations | |
class AliasTracker | |
private | |
def connection | |
ActiveRecord::Base.connection | |
rescue ActiveRecord::ConnectionNotEstablished | |
QuoteTableNamePatch | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment