Search code examples
hanamihanami-model

Less-than queries in a Lotus Model Repository


Is it possible to perform the following query in a Lotus::Model Repository?

def active
  query.where("publish_at >= #{Date.today}")
end

In Sequel, which Lotus::Model uses, you can do the above or you can pass it a block like so

where{publish_at >= Date.today}

This does not seem possible in Lotus as the conditions internal variable is a Set that requires a key and a value. I would love to know if anyone else has gotten this to work or a work around.


Solution

  • The query interface doesn't accept yet other values than the hash with a single key/value pair (eg. where(name: 'Lotus'). I'm planning to empower it soon.

    UPDATE: the lambda style query is now implemented in master.