Thank you everyone. I started to use `empty?` for faster and better results.

On Wednesday, February 24, 2021 at 12:43:47 AM UTC+3 Lukasz wrote:

> Right, good points. Thanks!
>
>
> On Tuesday, February 23, 2021 at 3:31:04 p.m. UTC-5 Jeremy Evans wrote:
>
>> On Tue, Feb 23, 2021 at 11:40 AM Lukasz <[email protected]> wrote:
>>
>>> What about: Person.select(1).where(name: "Dennis").first.present?
>>>
>>
>> !empty? is more efficient, at least if the record is large:
>>
>>   DB[:persons].where(name: 'Dennis').empty?
>>   SELECT 1 AS one FROM persons WHERE (name = 'Dennis') LIMIT 1
>>
>> Also, "present?" depends on ActiveSupport, and I would never recommend 
>> the use of ActiveSupport unless it was necessary.  Sequel does have some 
>> optional dependency on ActiveSupport (e.g. active_model plugin, pg_interval 
>> extension), and it's been a source of problems over the years.  Choosing to 
>> use ActiveSupport is in a general a poor Faustian bargain.
>>
>> Thanks,
>> Jeremy
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sequel-talk/2a15ca7c-ac63-483c-a06d-d655d340d45fn%40googlegroups.com.

Reply via email to