diff options
author | Marcel Molina <marcel@vernix.org> | 2005-10-14 23:28:35 +0000 |
---|---|---|
committer | Marcel Molina <marcel@vernix.org> | 2005-10-14 23:28:35 +0000 |
commit | 6a6df5f1e297a1b93233acbd851f123232ce1acf (patch) | |
tree | ed3ac6a0a1d5cdd6649d8c39bba910e09a8e9adc /activerecord/lib/active_record/base.rb | |
parent | f2c7634db58b52f8d0415a7002976089fea3191c (diff) | |
download | rails-6a6df5f1e297a1b93233acbd851f123232ce1acf.tar.gz rails-6a6df5f1e297a1b93233acbd851f123232ce1acf.tar.bz2 rails-6a6df5f1e297a1b93233acbd851f123232ce1acf.zip |
Change quote delimiters for sql interpolation to obviate SyntaxErrors. Closes 2215. [leroen@gmail.com]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2593 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/lib/active_record/base.rb')
-rwxr-xr-x | activerecord/lib/active_record/base.rb | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb index be8b672fa7..8bd2a4530b 100755 --- a/activerecord/lib/active_record/base.rb +++ b/activerecord/lib/active_record/base.rb @@ -1501,7 +1501,9 @@ module ActiveRecord #:nodoc: # Interpolate custom sql string in instance context. # Optional record argument is meant for custom insert_sql. def interpolate_sql(sql, record = nil) - instance_eval("%(#{sql})") + # Parens in the sql in, e.g., subselects, cause a parse error, so + # escape them. + instance_eval("%@#{sql.gsub('@', '\@')}@") end # Initializes the attributes array with keys matching the columns from the linked table and |