aboutsummaryrefslogtreecommitdiffstats
path: root/lib/arel/insert_manager.rb
diff options
context:
space:
mode:
authorErnie Miller <ernie@erniemiller.org>2013-03-16 19:20:11 -0400
committerErnie Miller <ernie@erniemiller.org>2013-04-28 22:20:16 -0700
commit68a95542e1a7a79d9777223fbffd2b982fed0268 (patch)
tree7ae8829cefd20f214cfac9f8f1b141b4f9146739 /lib/arel/insert_manager.rb
parent3ef63ac5366000b232ca5fe0848de9db9a3c1f9a (diff)
downloadrails-68a95542e1a7a79d9777223fbffd2b982fed0268.tar.gz
rails-68a95542e1a7a79d9777223fbffd2b982fed0268.tar.bz2
rails-68a95542e1a7a79d9777223fbffd2b982fed0268.zip
Make visitors threadsafe by removing @last_column
The last_column feature of the ToSql visitor and its descendants is what enabled quoting based on the column last visited -- in other words, if you have a standard condition like an equality with a string attribute on the left side and an integer on the right side, then when ARel visits the node, it'll first visit the left side attribute, setting the column of the string attribute as the last column, and resulting in the right side of the condition getting the appropriate quoting. The downside is that this means that visitors can't be shared between threads, because of the state mutation. It also makes for some really weird behavior in the event that the visitor visits a node that happens to contain an attribute you weren't expecting to be there, since it'll potentially quote something based on that attribute. So, it prevents reversing an equality condition. column = value will work, but not value = column, since the last column wouldn't be the column you're hoping for. This is a first pass at fixing this by changing the signature of the visit methods to accept the currently-relevant attribute, if any.
Diffstat (limited to 'lib/arel/insert_manager.rb')
0 files changed, 0 insertions, 0 deletions