diff options
author | Sean Griffin <sean@thoughtbot.com> | 2015-01-26 15:47:43 -0700 |
---|---|---|
committer | Sean Griffin <sean@thoughtbot.com> | 2015-01-26 15:47:43 -0700 |
commit | 9d4d2e7fc69e5eb0586e57259c2993143346a1b9 (patch) | |
tree | 5b558d35d282d6a74a117a56fbdb610a3718beb2 /activerecord/lib | |
parent | a384c002af413bcc258122533e70742dfe960fa8 (diff) | |
download | rails-9d4d2e7fc69e5eb0586e57259c2993143346a1b9.tar.gz rails-9d4d2e7fc69e5eb0586e57259c2993143346a1b9.tar.bz2 rails-9d4d2e7fc69e5eb0586e57259c2993143346a1b9.zip |
Ensure the type caster object given to Arel is always marshallable
The Relation will ultimately end up holding a reference to the arel
table object, and its associated type caster. If this is a
`TypeCaster::Connection`, that means it'll hold a reference to the
connection adapter, which cannot be marshalled. We can work around this
by just holding onto the class object instead. It's ugly, but I'm hoping
to remove the need for the connection adapter type caster in the future
anyway.
[Sean Griffin & anthonynavarre]
Diffstat (limited to 'activerecord/lib')
-rw-r--r-- | activerecord/lib/active_record/type_caster/connection.rb | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/activerecord/lib/active_record/type_caster/connection.rb b/activerecord/lib/active_record/type_caster/connection.rb index 9e4a130b40..1d204edb76 100644 --- a/activerecord/lib/active_record/type_caster/connection.rb +++ b/activerecord/lib/active_record/type_caster/connection.rb @@ -1,8 +1,8 @@ module ActiveRecord module TypeCaster class Connection - def initialize(connection, table_name) - @connection = connection + def initialize(klass, table_name) + @klass = klass @table_name = table_name end @@ -14,7 +14,8 @@ module ActiveRecord protected - attr_reader :connection, :table_name + attr_reader :table_name + delegate :connection, to: :@klass private |