Sha256: c35a23ce7dafcec35a7ba87ceb1650059fefb5078a829ee225473747fdca46c7

Contents?: true

Size: 882 Bytes

Versions: 48

Compression:

Stored size: 882 Bytes

Contents

class User < ActiveRecord::Base
  has_many :posts
  has_many :dogs, :foreign_key => :owner_id

  has_many :friendships
  has_many :friends, :through => :friendships

  has_one :address, :as => :addressable, :dependent => :destroy

  named_scope :old,      :conditions => "age > 50"
  named_scope :eighteen, :conditions => { :age => 18 }
  named_scope :recent,   lambda {|count| { :limit => count } }

  def self.recent_via_method(count)
    scoped(:limit => count)
  end

  attr_protected :password
  attr_readonly :name

  validates_format_of :email, :with => /\w*@\w*.com/
  validates_length_of :email, :in => 1..100
  validates_inclusion_of :age, :in => 1..100
  validates_acceptance_of :eula
  validates_uniqueness_of :email, :scope => :name
  validates_length_of :ssn, :is => 9, :message => "Social Security Number is not the right length"
  validates_numericality_of :ssn
end

Version data entries

48 entries across 48 versions & 12 rubygems

Version Path
carlosbrando-remarkable-0.0.99 spec/rails_root/app/models/user.rb
emschwar-shoulda-2.0.6.1 test/rails_root/app/models/user.rb
francois-shoulda-2.0.5.1 test/rails_root/app/models/user.rb
francois-shoulda-2.0.5.2 test/rails_root/app/models/user.rb
francois-shoulda-2.0.5.4 test/rails_root/app/models/user.rb
gsterndale-warrant-0.2.0 test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.6/test/rails_root/app/models/user.rb
gsterndale-warrant-0.3.0 test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.6/test/rails_root/app/models/user.rb
hashrocket-clearance-0.4.0 test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/test/rails_root/app/models/user.rb
hashrocket-clearance-0.4.1 test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/test/rails_root/app/models/user.rb
hashrocket-clearance-0.4.2 test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/test/rails_root/app/models/user.rb
hashrocket-clearance-0.4.3 test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/test/rails_root/app/models/user.rb
mattknox-goaloc-0.3.0 lib/goaloc/generators/resources/shoulda/test/rails_root/app/models/user.rb
mattknox-goaloc-0.4.0 lib/goaloc/generators/resources/shoulda/test/rails_root/app/models/user.rb
mjankowski-shoulda-2.0.4 test/rails_root/app/models/user.rb
mjankowski-shoulda-2.0.5 test/rails_root/app/models/user.rb
rmm5t-shoulda-2.0.2 test/rails_root/app/models/user.rb
rmm5t-shoulda-2.0.5 test/rails_root/app/models/user.rb
rmm5t-shoulda-2.0.6 test/rails_root/app/models/user.rb
technicalpickles-shoulda-2.0.1 test/rails_root/app/models/user.rb
technicalpickles-shoulda-2.0.2 test/rails_root/app/models/user.rb