mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
table responds to take
This commit is contained in:
parent
6544a9b369
commit
f47d083c5b
2 changed files with 12 additions and 0 deletions
|
@ -26,6 +26,10 @@ module Arel
|
|||
tm.project thing
|
||||
end
|
||||
|
||||
def take amount
|
||||
tm.take amount
|
||||
end
|
||||
|
||||
def columns
|
||||
@columns ||= @engine.connection.columns(@name, "#{@name} Columns").map do |column|
|
||||
Attributes.for(column).new self, column.name, column
|
||||
|
|
|
@ -18,6 +18,14 @@ module Arel
|
|||
end
|
||||
end
|
||||
|
||||
describe 'take' do
|
||||
it "should add a limit" do
|
||||
manager = @relation.take 1
|
||||
manager.project '*'
|
||||
manager.to_sql.should be_like %{ SELECT * FROM "users" LIMIT 1 }
|
||||
end
|
||||
end
|
||||
|
||||
describe 'project' do
|
||||
it 'can project' do
|
||||
manager = @relation.project '*'
|
||||
|
|
Loading…
Reference in a new issue