Sha256: 3c165556e0979d9d1ae0310e9963056edc33740be8398a31b9b1d965d26129b1

Contents?: true

Size: 523 Bytes

Versions: 6

Compression:

Stored size: 523 Bytes

Contents

class User
  include Mongoid::Document
  
  field :login
  field :email
  field :role
  
  has_many_related :articles
  has_many_related :comments
  
  embeds_one :profile
  
  validates :login, :presence => true, :uniqueness => true, :format => { :with => /^[\w\-]+$/ }
  validates :email, :presence => true, :uniqueness => true
  validates :role, :presence => true, :inclusion => { :in => ["admin", "moderator", "member"]}  
  validates :profile, :presence => true, :associated => true
  
  def admin?
    false
  end
end

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
mongoid-rspec-1.1.2 spec/models/user.rb
mongoid-rspec-1.1.1 spec/models/user.rb
mongoid-rspec-1.1.0 spec/models/user.rb
mongoid-rspec-1.0.4 spec/models/user.rb
mongoid_rspec_ign-1.0.3 spec/models/user.rb
mongoid-rspec-1.0.3 spec/models/user.rb