1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

group is implemented on table

This commit is contained in:
Aaron Patterson 2010-09-07 16:09:58 -07:00
parent 7dcc76606b
commit cea486ac81
2 changed files with 12 additions and 0 deletions

View file

@ -15,6 +15,9 @@ module Arel
def group *columns
columns.each do |column|
# FIXME: backwards compat
column = Nodes::SqlLiteral.new(column) if String === column
@ctx.groups.push Nodes::Group.new column
end
self

View file

@ -154,6 +154,15 @@ module Arel
SELECT FROM "users" GROUP BY "users"."id", "users"."name"
}
end
# FIXME: backwards compat
it 'makes strings literals' 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 'delete' do