aboutsummaryrefslogtreecommitdiffstats
path: root/lib/active_relation/relations/relation.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/active_relation/relations/relation.rb')
-rw-r--r--lib/active_relation/relations/relation.rb14
1 files changed, 6 insertions, 8 deletions
diff --git a/lib/active_relation/relations/relation.rb b/lib/active_relation/relations/relation.rb
index f5f2809724..b62a5d9fb9 100644
--- a/lib/active_relation/relations/relation.rb
+++ b/lib/active_relation/relations/relation.rb
@@ -18,12 +18,14 @@ module ActiveRelation
include Enumerable
module Operations
- def join(other)
+ def join(other = nil)
case other
when String
Join.new(other, self)
when Relation
JoinOperation.new("INNER JOIN", self, other)
+ else
+ self
end
end
@@ -48,7 +50,7 @@ module ActiveRelation
attributes.all?(&:blank?) ? self : Projection.new(self, *attributes)
end
- def as(aliaz)
+ def as(aliaz = nil)
aliaz.blank?? self : Alias.new(self, aliaz)
end
@@ -56,18 +58,14 @@ module ActiveRelation
attributes.all?(&:blank?) ? self : Order.new(self, *attributes)
end
- def take(taken)
+ def take(taken = nil)
taken.blank?? self : Take.new(self, taken)
end
- def skip(skipped)
+ def skip(skipped = nil)
skipped.blank?? self : Skip.new(self, skipped)
end
- def rename(attribute, aliaz)
- Rename.new(self, attribute => aliaz)
- end
-
def aggregate(*expressions)
AggregateOperation.new(self, expressions)
end