diff options
-rw-r--r-- | lib/arel/algebra/relations/relation.rb | 10 | ||||
-rw-r--r-- | spec/algebra/unit/relations/relation_spec.rb | 4 |
2 files changed, 11 insertions, 3 deletions
diff --git a/lib/arel/algebra/relations/relation.rb b/lib/arel/algebra/relations/relation.rb index 1d395777c1..9936b9689f 100644 --- a/lib/arel/algebra/relations/relation.rb +++ b/lib/arel/algebra/relations/relation.rb @@ -123,7 +123,7 @@ module Arel end %w{ - where project order take skip group from having + where project order skip group having }.each do |operation_name| class_eval <<-OPERATION, __FILE__, __LINE__ def #{operation_name}(*arguments) @@ -133,6 +133,14 @@ module Arel OPERATION end + def take thing + Take.new self, thing + end + + def from thing + From.new self, thing + end + def lock(locking = nil) Lock.new(self, locking) end diff --git a/spec/algebra/unit/relations/relation_spec.rb b/spec/algebra/unit/relations/relation_spec.rb index be77c64b17..4e25de73d1 100644 --- a/spec/algebra/unit/relations/relation_spec.rb +++ b/spec/algebra/unit/relations/relation_spec.rb @@ -115,8 +115,8 @@ module Arel end describe 'when given a blank number of items' do - it 'returns self' do - @relation.take.should == @relation + it 'raises error' do + lambda { @relation.take }.should raise_exception end end end |