aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record
diff options
context:
space:
mode:
Diffstat (limited to 'activerecord/lib/active_record')
-rwxr-xr-xactiverecord/lib/active_record/base.rb4
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