mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
supporting symbols for group statements
This commit is contained in:
parent
d4abd35feb
commit
6cd4e8f51f
2 changed files with 13 additions and 0 deletions
|
@ -43,6 +43,7 @@ module Arel
|
|||
columns.each do |column|
|
||||
# FIXME: backwards compat
|
||||
column = Nodes::SqlLiteral.new(column) if String === column
|
||||
column = Nodes::SqlLiteral.new(column.to_s) if Symbol === column
|
||||
|
||||
@ctx.groups.push Nodes::Group.new column
|
||||
end
|
||||
|
|
|
@ -27,6 +27,18 @@ module Arel
|
|||
|
||||
describe 'select manager' do
|
||||
describe 'backwards compatibility' do
|
||||
describe 'group' do
|
||||
it 'takes a symbol' do
|
||||
table = Table.new :users
|
||||
manager = Arel::SelectManager.new Table.engine
|
||||
manager.from table
|
||||
manager.group :foo
|
||||
manager.to_sql.should be_like %{
|
||||
SELECT FROM "users" GROUP BY foo
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
describe 'from' do
|
||||
it 'ignores strings when table of same name exists' do
|
||||
table = Table.new :users
|
||||
|
|
Loading…
Reference in a new issue