Sha256: cee5bb9b90178db25449d5e0a4fecbafd909adb16c0b13b46dfe4d845e65695f

Contents?: true

Size: 1.21 KB

Versions: 16

Compression:

Stored size: 1.21 KB

Contents

# Copyright 2011-2012 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"). You
# may not use this file except in compliance with the License. A copy of
# the License is located at
#
#     http://aws.amazon.com/apache2.0/
#
# or in the "license" file accompanying this file. This file is
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
# ANY KIND, either express or implied. See the License for the specific
# language governing permissions and limitations under the License.

class User < AWS::Record::HashModel

  set_shard_name 'ruby-users'

  optimistic_locking

  ## attributes

  string_attr :username
  string_attr :role
  string_attr :tags, :set => true

  boolean_attr :verified, :default => false

  timestamps

  ## validations

  validates_presence_of :username, :role

  validates_inclusion_of :role, 
    :in => %w(root admin member), 
    :allow_nil => true

  validates_length_of :username, 
    :within => 3..20, 
    :allow_nil => true

  validates_format_of :username, :tags,
    :with => /^[a-z0-9]+$/i, 
    :allow_nil => true,
    :message => 'may only be letters and numbers'

  validates_count_of :tags, :maximum => 3

end

Version data entries

16 entries across 16 versions & 2 rubygems

Version Path
aws-sdk-1.6.5 lib/user.rb
aws-sdk-1.6.4 lib/user.rb
aws-sdk-1.6.3 lib/user.rb
aws-sdk-1.6.2 lib/user.rb
aws-sdk-1.6.1 lib/user.rb
aws-sdk-1.6.0 lib/user.rb
aws-sdk-1.5.8 lib/user.rb
aws-sdk-1.5.7 lib/user.rb
aws-sdk-1.5.6 lib/user.rb
aws-sdk-1.5.5 lib/user.rb
aws-sdk-1.5.4 lib/user.rb
aws-sdk-1.5.3 lib/user.rb
aws_sdk-3.1.5 lib/user.rb
aws-sdk-1.5.2 lib/user.rb
aws-sdk-1.5.1 lib/user.rb
aws-sdk-1.5.0 lib/user.rb