Class AWS::Record::Scope
In: lib/aws/record/scope.rb
Parent: Object

Methods

_shard   build   count   domain   domain   each   find   first   limit   new   new   shard   size  

Included Modules

Enumerable

Attributes

base_class  [R]  @return [Class] Returns the AWS::Record::Model extending class that
  this scope will find records for.

Public Class methods

@param base_class A class that extends {AWS::Record::AbstractBase}. @param [Hash] options @option options : @api private

Public Instance methods

build(attributes = {})

Alias for new

@return [Integer] Returns the number of records that match the

  current scoped finder.
domain(shard_name)

Alias for shard

Yields once for each record matching the request made by this scope.

@example

  books = Book.where(:author => 'me').order(:price, :asc).limit(10)

  books.each do |book|
    puts book.attributes.to_yaml
  end

@yieldparam [Object] record

@overload find(id)

  Finds and returns a single record by id.  If no record is found
  with the given `id`, then a RecordNotFound error will be raised.
  @param [String] id ID of the record to find.
  @return Returns the record.

@overload find(:first, options = {})

  Returns the first record found.  If no records were matched then
  nil will be returned (raises no exceptions).
  @param [Symbol] mode (:first)
  @return [Object,nil] Returns the first record or nil if no
    records matched the conditions.

@overload find(:all, options = {})

  Returns an enumerable Scope object that represents all matching
  records.  No request is made to AWS until the scope is enumerated.

      Book.find(:all, :limit => 100).each do |book|
        # ...
      end

  @param [Symbol] mode (:all)
  @return [Scope] Returns an enumerable scope object.

@return Returns the first record found, returns

  nil if the domain/table is empty.

Limits the maximum number of total records to return when finding or counting. Returns a scope, does not make a request.

@example

  books = Book.limit(100)

@param [Integer] limit The maximum number of records to return. @return [Scope] Returns a new scope that has the applied limit.

@param [String] shard_name @return [Scope] Returns a scope that specifies which shard

  (i.e. SimpleDB domain) should be used.
size(options = {})

Alias for count

Protected Instance methods

domain(shard_name)

Alias for shard

[Validate]