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

No need to create a new relation if the argument is blank.

This commit is contained in:
Emilio Tagua 2009-08-25 19:47:29 -03:00
parent 51910106f1
commit 33746c44cb
2 changed files with 7 additions and 7 deletions

View file

@ -21,27 +21,27 @@ module ActiveRecord
end
def select(selects)
Relation.new(@klass, @relation.project(selects))
selects.blank? ? self : Relation.new(@klass, @relation.project(selects))
end
def group(groups)
Relation.new(@klass, @relation.group(groups))
groups.blank? ? self : Relation.new(@klass, @relation.group(groups))
end
def order(orders)
Relation.new(@klass, @relation.order(orders))
orders.blank? ? self : Relation.new(@klass, @relation.order(orders))
end
def limit(limits)
Relation.new(@klass, @relation.take(limits))
limits.blank? ? self : Relation.new(@klass, @relation.take(limits))
end
def offset(offsets)
Relation.new(@klass, @relation.skip(offsets))
offsets.blank? ? self : Relation.new(@klass, @relation.skip(offsets))
end
def on(join)
Relation.new(@klass, @relation.on(join))
join.blank? ? self : Relation.new(@klass, @relation.on(join))
end
def joins(join, join_type = nil)

2
arel

@ -1 +1 @@
Subproject commit 3d747a56b76ae97645dd265cc75e73e5f7827193
Subproject commit 755a7ced2f98b0bb246089c80cdfa04cd918fa89