public
Created

  • Download Gist
old-lists-syntax.rb
Ruby
1 2 3 4 5 6 7 8 9 10 11 12
class Comment < Ohm::Model
end
 
class Post < Ohm::Model
list :comments, Comment
end
 
post = Post.create
10.times { post.comments.push(Comment.create) }
 
# Getting the first 3 comments could only be done using:
Ohm.redis.lrange post.comments.key, 0, 2

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.