Questions tagged [ohm]

A gem for mapping Ruby objects to Redis.

25 questions
1
vote
1 answer

Ohm list and unique not working

Documentation says Ohm lists are treated just like a Ruby array, but I see the following issues: MyModel.new in rails console produces: ArgumentError: wrong number of arguments (1 for 2) That's on a line where I have list :foo where foo should be an…
randombits
  • 47,058
  • 76
  • 251
  • 433
0
votes
1 answer

Simple pagination in redis using ohm ruby library

Hi guys I am trying to learn the sinatra framework and would like to use it as the backend for simple web services. I am also attempting to get my hands dirty with no-sequel solutions and for some reasons decided to learn to work with redis. As for…
Lester Celestial
  • 1,454
  • 1
  • 16
  • 26
0
votes
1 answer

Many-to-many relationships with Ruby, Redis, and Ohm

I'm attempting to create a many-to-many relationship in Redis using Ohm. As an example, I have Book and Author models defined as follows: class Book < Ohm::Model attribute :title set :authors, Author end class Author < Ohm::Model attribute…
wmkoch
  • 175
  • 9
0
votes
1 answer

How do you push an element onto a list dynamically in Redis/Ohm?

This is a follow-up to this question: Setting a dynamic field in Ohm / Redis I'm unable to find the method that I can use with the send() method, to dynamically be able to add an object to an unknown list. I tried adding this method to the…
Jeremy Smith
  • 14,727
  • 19
  • 67
  • 114
0
votes
1 answer

Ruby Ohm: do not raise unique index violation, just return false

In ohm when I try to save a unique attribute it raises an error if the attribute is not unique. Is there a way to have it simply return false instead of raising the error? This is the type of code I want, but it raises an error if the domain is not…
Josh
  • 655
  • 5
  • 17
0
votes
1 answer

Sorting by datetime with Redis/Ohm

here is my model: class Thing < Ohm::Model attribute :created_at index :created_at end I'm not able to sort the records by datetime (created_at). Thing.all.order_by(:created_at) NoMethodError: undefined method `each' for…
ngw
  • 1,222
  • 1
  • 14
  • 34
0
votes
1 answer

Overriding attributes of Ohm models

I'm experiencing a very weird problem with Ohm that I'm not able to track and solve. Ohm version is 2.0.1. This is my code: class User < Ohm::Model attribute :username attribute :password index :username def password= string …
ngw
  • 1,222
  • 1
  • 14
  • 34
0
votes
1 answer

Finder method to return the last item in a collection, redis, ohm

ohm provides a finder method for returning the first result, but doesn't seem to provide a similar .last finder method, is there something similar to the below for the returning the last result in a collection? Book.find(authors:…
user715697
  • 857
  • 1
  • 10
  • 20
0
votes
2 answers

Ruby Data_Mapper resource not able to be saved - expecting different data type

I'm attempting to save some information relating to real estate in my local area. I'm using Ruby with the Data_Mapper gem to persist the data to a local MySQL database. The models currently look like thus: class Property include…
Michael
  • 33
  • 5
0
votes
1 answer

redis ohm slow performance

We're scratching our heads the last couple of days trying to understand why some things seem a bit too slow with redis/ohm on our rails project. The gist of it is that some requests to ohm/redis take around 100-200 ms, which seem rather high…
gingerlime
  • 5,206
  • 4
  • 37
  • 66
1
2