You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was curious if anyone thought a method that fetches records by a unique and an array of values would be useful on Ohm::Model? It would look something like...
# I'm not a fan of the method name...
def self.fetch_with(att, values)
raise Ohm::IndexNotFound unless uniques.include?(att)
ids = nil
unique = key[:uniques][att]
synchronize do
values.map { |value| redis.queue('HGET', unique, value) }
ids = redis.commit
end
return [] if ids.nil?
fetch(ids)
end
There is a point in the application I'm working on that uses something similar, and just wanted to share incase you all might find a generic version of it it useful for everyone.
The text was updated successfully, but these errors were encountered:
There is a couple of points I am using something very similar to what I wrote above. Basically the app has some light social features and an example where it can be useful is to look up a collection of users via unique nicknames instead of id.
Hi all,
I was curious if anyone thought a method that fetches records by a unique and an array of values would be useful on Ohm::Model? It would look something like...
There is a point in the application I'm working on that uses something similar, and just wanted to share incase you all might find a generic version of it it useful for everyone.
The text was updated successfully, but these errors were encountered: