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:
parent
7dcc76606b
commit
cea486ac81
2 changed files with 12 additions and 0 deletions
|
@ -15,6 +15,9 @@ module Arel
|
||||||
|
|
||||||
def group *columns
|
def group *columns
|
||||||
columns.each do |column|
|
columns.each do |column|
|
||||||
|
# FIXME: backwards compat
|
||||||
|
column = Nodes::SqlLiteral.new(column) if String === column
|
||||||
|
|
||||||
@ctx.groups.push Nodes::Group.new column
|
@ctx.groups.push Nodes::Group.new column
|
||||||
end
|
end
|
||||||
self
|
self
|
||||||
|
|
|
@ -154,6 +154,15 @@ module Arel
|
||||||
SELECT FROM "users" GROUP BY "users"."id", "users"."name"
|
SELECT FROM "users" GROUP BY "users"."id", "users"."name"
|
||||||
}
|
}
|
||||||
end
|
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
|
end
|
||||||
|
|
||||||
describe 'delete' do
|
describe 'delete' do
|
||||||
|
|
Loading…
Reference in a new issue