require 'type_cartographer' module People class User < ActiveRecord::Base <% if options.arcadex? %> has_many :tokens, :as => :imageable, :class_name => "::Arcadex::Token" <% end %> has_secure_password after_create :setup_user validates :username, presence: true #validates_format_of :username, :with => /\A[A-Za-z0-9\d]+\Z/i validates :email, presence: true #Might need a regex for emails, or just rather confirm them <% if options.arcadex? %> def setup_user create_token end def create_token self.tokens.create! end <% end %> end end