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/14fbec2c-6705-44a5-b99a-8be2f772cef3n%40googlegroups.com.
