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/CADGZSSeEGMYHmie8P2fD1MwS2yQF4fav83QCKCyJB_detxw9NQ%40mail.gmail.com.
