Method: Aws::ActiveSdb::Base.find

Defined in:
lib/sdb/active_sdb.rb

.find(*args) ⇒ Object

See select(), original find with QUERY syntax is deprecated so now find and select are synonyms.



262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
# File 'lib/sdb/active_sdb.rb', line 262

def find(*args)
      options = args.last.is_a?(Hash) ? args.pop : {}
    case args.first
        when nil then
            raise "Invalid parameters passed to find: nil."
        when :all then
            sql_select(options)[:items]
        when :first then
            sql_select(options.merge(:limit => 1))[:items].first
        when :count then
            res = sql_select(options.merge(:count => true))[:count]
            res
        else
            res = select_from_ids(args, options)
            return res[:single] if res[:single]
            return res[:items]
    end
end