Commit d66b1249 authored by Arturo Herrero's avatar Arturo Herrero

Remove unnecessary limit using exists?

limit is not necessary because exists? always adds limit(1).
parent ddd41c03
...@@ -11,7 +11,7 @@ class PlanLimits < ApplicationRecord ...@@ -11,7 +11,7 @@ class PlanLimits < ApplicationRecord
else else
# object.count >= limit value is slower than checking # object.count >= limit value is slower than checking
# if a record exists at the limit value - 1 position. # if a record exists at the limit value - 1 position.
object.limit(1).offset(read_attribute(limit_name) - 1).exists? object.offset(read_attribute(limit_name) - 1).exists?
end end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment