diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2014-02-24 16:12:41 -0800 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2014-02-24 16:12:41 -0800 |
commit | 24995298face1d08ffb52f6c1b0374feeb7a380b (patch) | |
tree | d615edd8bca27a4f2e3f1e8f94200556aa6898ef /lib/arel/visitors | |
parent | b2a8dee86cfc00fa70841778e13e8b33f404e4e3 (diff) | |
parent | 164645423935738ca7a56ef233b3c4fd9d43eea3 (diff) | |
download | rails-24995298face1d08ffb52f6c1b0374feeb7a380b.tar.gz rails-24995298face1d08ffb52f6c1b0374feeb7a380b.tar.bz2 rails-24995298face1d08ffb52f6c1b0374feeb7a380b.zip |
Merge pull request #246 from cmohanprasath/assign_value_from_attribute_test
Assign value from attribute test
Diffstat (limited to 'lib/arel/visitors')
-rw-r--r-- | lib/arel/visitors/to_sql.rb | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/arel/visitors/to_sql.rb b/lib/arel/visitors/to_sql.rb index bd0cd8f03c..236f0354b1 100644 --- a/lib/arel/visitors/to_sql.rb +++ b/lib/arel/visitors/to_sql.rb @@ -501,8 +501,13 @@ module Arel end def visit_Arel_Nodes_Assignment o, a - right = quote(o.right, column_for(o.left)) - "#{visit o.left, a} = #{right}" + case o.right + when Arel::Nodes::UnqualifiedColumn, Arel::Attributes::Attribute + "#{visit o.left, a} = #{visit o.right, a}" + else + right = quote(o.right, column_for(o.left)) + "#{visit o.left, a} = #{right}" + end end def visit_Arel_Nodes_Equality o, a |