Module ActiveRecord::Acts::MuckUser::ClassMethods
In: lib/active_record/acts/muck_user.rb

Methods

Included Modules

ActiveRecord::Acts::MuckUser::InstanceMethods

Public Instance methods

[Source]

# File lib/active_record/acts/muck_user.rb, line 10
        def acts_as_muck_user(options = {})

          has_many :permissions
          has_many :roles, :through => :permissions

          named_scope :by_newest, :order => "created_at DESC"
          named_scope :active, :conditions => "activated_at IS NOT NULL"
          named_scope :inactive, :conditions => "activated_at IS NULL"    
          named_scope :recent, lambda { { :conditions => ['created_at > ?', 1.week.ago] } }
          
          email_name_regex  = '[\w\.%\+\-]+'.freeze
          domain_head_regex = '(?:[A-Z0-9\-]+\.)+'.freeze
          domain_tld_regex  = '(?:[A-Z]{2}|com|org|net|edu|gov|mil|biz|info|mobi|name|aero|jobs|museum)'.freeze
          email_regex       = /\A#{email_name_regex}@#{domain_head_regex}#{domain_tld_regex}\z/i

          class_eval "validates_format_of :login, :with => /^[a-z0-9-]+$/i, :message => 'may only contain letters, numbers or a hyphen.'\nvalidates_format_of :email, :with => email_regex, :message => 'does not look like a valid email address.'\n\n# prevents a user from submitting a crafted form that bypasses activation\nattr_protected :crypted_password, :password_salt, :persistence_token, :single_access_token, :perishable_token, :login_count,\n:failed_login_count, :last_request_at, :last_login_at, :current_login_at, :current_login_ip, :last_login_ip,\n:terms_of_service, :time_zone, :disabled_at, :activated_at, :created_at, :updated_at\n"

          include ActiveRecord::Acts::MuckUser::InstanceMethods
          extend ActiveRecord::Acts::MuckUser::SingletonMethods
          
        end

[Validate]