diff options
author | Sean Griffin <sean@thoughtbot.com> | 2015-05-30 12:26:41 -0600 |
---|---|---|
committer | Sean Griffin <sean@thoughtbot.com> | 2015-05-30 12:35:51 -0600 |
commit | 0ef7e73f0af752002c6150bd1cf29586d8bd21c9 (patch) | |
tree | 7dcfc25e7c52682a4343c2ba7188a69e7c06c936 /activerecord/CHANGELOG.md | |
parent | 6bd2573869eda8b1e4eaa9df2966f814fd9c5d5c (diff) | |
download | rails-0ef7e73f0af752002c6150bd1cf29586d8bd21c9.tar.gz rails-0ef7e73f0af752002c6150bd1cf29586d8bd21c9.tar.bz2 rails-0ef7e73f0af752002c6150bd1cf29586d8bd21c9.zip |
Ensure symbols passed to `select` are always quoted
Our general contract in Active Record is that strings are assumed to be
SQL literals, and symbols are assumed to reference a column. If a from
clause is given, we shouldn't include the table name, but we should
still quote the value as if it were a column.
Upon fixing this, the tests were still failing on SQLite. This was
because the column name being returned by the query was `"\"join\""`
instead of `"join"`. This is actually a bug in SQLite that was fixed a
long time ago, but I was using the version of SQLite included by OS X
which has this bug. Since I'm guessing this will be a common case for
contributors, I also added an explicit check with a more helpful error
message.
Fixes #20360
Diffstat (limited to 'activerecord/CHANGELOG.md')
-rw-r--r-- | activerecord/CHANGELOG.md | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/activerecord/CHANGELOG.md b/activerecord/CHANGELOG.md index fff1f75567..2cd9791aa0 100644 --- a/activerecord/CHANGELOG.md +++ b/activerecord/CHANGELOG.md @@ -1,3 +1,10 @@ +* Ensure symbols passed to `ActiveRecord::Relation#select` are always treated + as columns. + + Fixes #20360. + + *Sean Griffin* + * Do not set `sql_mode` if `strict: :default` is specified. ``` |