Skip to content

Ohm::Model#find errors when dealing with empty Sets #3

@inf0rmer

Description

@inf0rmer

Hi! I'm having a small problem with the Ohm integration, specifically when using Ohm::Model#find. If the returned Set is empty, calling methods such as to_a or first on it will crash with an error:

releases = Release.find(commit_hash: "does_not_exist")

releases.first
# NoMethodError: undefined method `each' for nil:NilClass
# from /Users/brunoabrantes/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/redic-pool-1.0.1/lib/redic/pool.rb:30:in `block in commit'

I've tested this with a normal Redis connection (so no Connection Pooling) and it works as expected, returning nil. to_a will also return an empty array as expected.

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions