Sha256: 2b9886018f57bfa1924c5401f48ec73f5de6d9f3c292cb9ce55cdcbac1026acf

Contents?: true

Size: 775 Bytes

Versions: 5

Compression:

Stored size: 775 Bytes

Contents

require 'type_cartographer'

module People
  class V1::User < ActiveRecord::Base
    self.table_name = 'people_users'
    
    before_save { self.email = email.downcase }
    before_save { self.username = username.downcase }

  
  	has_many :tokens, :as => :imageable, :class_name => "::Arcadex::Token"
  
  	has_secure_password

  	after_create :setup_user

    validates :username, presence: true, :uniqueness => { :case_sensitive => false }
    #validates_format_of :username, :with => /\A[A-Za-z0-9\d]+\Z/i
    validates :email, presence: true, :uniqueness => { :case_sensitive => false }
    #Might need a regex for emails, or just rather confirm them

  
    def setup_user
    	create_token
    end

    def create_token
      self.tokens.create!
    end
  
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
arcadex-1.3.1 test/test_app/engines/people/app/models/people/v1/user.rb
arcadex-1.3.0 test/test_app/engines/people/app/models/people/v1/user.rb
arcadex-1.2.3 test/test_app/engines/people/app/models/people/v1/user.rb
arcadex-1.2.1 test/test_app/engines/people/app/models/people/v1/user.rb
arcadex-1.2.0 test/test_app/engines/people/app/models/people/v1/user.rb