Questions tagged [ohm]

A gem for mapping Ruby objects to Redis.

25 questions
73
votes
4 answers

Retrieving/Listing all key/value pairs in a Redis db

I'm using an ORM called Ohm in Ruby that works on top of Redis and am curious to find out how the data is actually stored. I was wondering if there is way to list all the keys/values in a Redis db. Update: A note for others trying this out using…
Jagtesh Chadha
  • 2,632
  • 2
  • 23
  • 30
16
votes
2 answers

Nodejs Object Document Model for Redis

I'm want use an ODM for redis in node.js. Does anybody have any experience using any? I ideally want something that is somewhat the equivalent of mongoose (except instead for Redis instead of Mongodb). The two I have heard of so far are nohm and…
GTDev
  • 5,488
  • 9
  • 49
  • 84
5
votes
2 answers

Ohm & Redis: when to use set, list or collection?

What is the difference between a collection and a set or list when using Ohm & Redis? Several of the Ohm examples use a list rather than a collection (see the list doc itself): class Post < Ohm::Model list :comments, Comment end class Comment <…
Toby Hede
  • 36,755
  • 28
  • 133
  • 162
4
votes
3 answers

Migrating Delphi DFM's with special characters to D2009

I've got a number of Delphi forms where we use a couple of special characters - the 'degree' symbol, and the 'ohms' symbol. These characters are used in label captions saved in the DFM file and are not generated or modified at runtime. Back along…
Brian Frost
  • 13,334
  • 11
  • 80
  • 154
2
votes
2 answers

Doing a batch delete in redis with ohm

Is there a way to delete multiple objects in redis via the ruby gem ohm? Right now to delete multiple data we do a loop and call object.delete each one of them. I would appreciate if anyone could point me to the right direction.
Lester Celestial
  • 1,454
  • 1
  • 16
  • 26
2
votes
2 answers

How to use a form on Redis and Ohm and without ActiveRecord?

I am using redis as database and ohm as ActiveRecord replacement. When I create a form for creating an object I may use the form_for viewhelper to easyly create forms to edit and create objects. Is there something like that for ohm? Best regards,…
monavari-lebrecht
  • 900
  • 3
  • 9
  • 23
2
votes
2 answers

Setting a dynamic field in Ohm / Redis

How do I set a field dynamically for a Ohm object? class OhmObj < Ohm::Model attribute :foo attribute :bar attribute :baz def add att, val self[att] = val end end class OtherObj def initialize @ohm_obj = OhmObj.create end …
Jeremy Smith
  • 14,727
  • 19
  • 67
  • 114
2
votes
1 answer

Converting Ohm model tree into a JSON structure

I have a tree of Ohm models. A Game has Players, a Player has Pieces. The full details are below. Basically, when I go to render the structure as json, I see an encoding error: NoMethodError (undefined method `encode_json' for…
Toby Hede
  • 36,755
  • 28
  • 133
  • 162
2
votes
1 answer

Ohm: how to drop a column/attribute?

There's an attribute that I no longer need, and I would like to drop it. I can't seem to simply remove the attribute from my model code, because there is an error when I load the instance. It complains that the myattrib= method does not exist. I…
Ramon Tayag
  • 15,224
  • 9
  • 43
  • 69
2
votes
2 answers

Ohm, find all records from array of ids

I am looking for a way to find all Ohm affiliated objects with one query, by feeding it an array of attributes that are indexed. In Mongoid, this is done with something like: Foo.any_in(:some_id => [list_of_ids]) ActiveRecord has the find_all…
randombits
  • 47,058
  • 76
  • 251
  • 433
2
votes
3 answers

Possible to expire the contents of an entire objects in Ohm for Ruby?

Once a particular event of mine hits, I want to be able to expire the entire contents of an Ohm based object in my Ruby on Rails app. Is it possible to tie in Redis + expire to do this currently? Objects have multiple keys associated with them when…
randombits
  • 47,058
  • 76
  • 251
  • 433
1
vote
2 answers

Ruby Ohm, how to find a record in a set or collection?

This question is related to other: Many-to-many relationships with Ruby, Redis, and Ohm I have a Model with a collection and I would like to look for an id. How can I do this? Models class User < Ohm::Model attribute :name end class Event <…
Fran b
  • 3,016
  • 6
  • 38
  • 65
1
vote
1 answer

Ruby Ohm, undefined method exception when trying create a model setting an array with ids

I have tried to set an array with ids in a model attribute like is explained within https://github.com/soveran/ohm#models but I get an exception. What is wrong in my code? Model class Event < Ohm::Model attribute :title set :attendees,…
Fran b
  • 3,016
  • 6
  • 38
  • 65
1
vote
0 answers

Ohm::DataTypes::Type::Hash can't convert normal hash to SerializedHash

Maybe this question is too naive, but it really confused me. Here is my code, a profession class. class Profession < OhmModel include ProfessionMethods attribute :type, Type::Integer attribute :level, Type::Integer attribute :add_point, …
LiPing
  • 11
  • 2
1
vote
2 answers

Is it possible to update model attributes using Ohm and Redis DB is Ruby?

I'm taking a first look at Monk and the Ohm/Redis APIs and I have a simple question. Is it possible to update attributes on model objects using Ohm/Redis? class Event < Ohm::Model attribute :name index :name end Event.create(:name => "A…
seanbehan
  • 1,463
  • 15
  • 23
1
2