Repository queries are not chainable?

Hi, asked the same in the chat room. New to Hanami and not sure about the best place to ask questions like this…
Got a problem with using repositories and the code below returns
undefined method `all’ for ROM::Relation::Composite
It seems query methods are not chainable?

class UsersRepository < Hanami::Repository
def yesterday_and_older
users.where{ created_at < (DateTime.now() - 1.0) }.all
end
end

Could someone shed a light on it?

Replying to myself here in case this may help to anyone reading it later. .all is not necessary, where() or where{} returns the result set right away which you may use or .delete etc. Thanks to all who helped me in the chat with it.

1 Like