Skip to content

Instantly share code, notes, and snippets.

@duff
Created October 27, 2010 20:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save duff/649855 to your computer and use it in GitHub Desktop.
Save duff/649855 to your computer and use it in GitHub Desktop.
# An account has payment methods. I'd like to know the payment methods for an account
# which meet some criteria.
# The 2 models
class Account
include Ripple::Document
many :payment_methods
end
class PaymentMethod
include Ripple::Document
one :account
property :storage_state, String
end
# In Active Record I can do the following:
account = Account.first
account.payment_methods.retained
# since there can be a named scope such as:
class PaymentMethod
scope :retained, :conditions => [ "storage_state = ?", "retained" ]
end
# I'm wondering what the best way might be to do this in Riak.
@duff
Copy link
Author

duff commented Nov 5, 2010

We'll see! I've been a bit surprised how little querying I've needed to do for the app I'm working on. At this point, I'm in "get some things working" mode. I'm now querying for strings and dates. I don't yet have enough real uses of querying in real apps to have a worthy pull request ready. I would think that would change over time. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment