Sha256: 93ee39dcf5222d4a5788933a3b90cd0bf85a0c2a6c7037fae5aa6f9a81ff6fbb

Contents?: true

Size: 647 Bytes

Versions: 3

Compression:

Stored size: 647 Bytes

Contents

require 'type_cartographer'

module People
  class V1::User < ActiveRecord::Base
    self.table_name = 'people_users'

  <% 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

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
json_voorhees-0.3.6 lib/generators/json_voorhees/app_make_user/templates/user/user_model.rb
json_voorhees-0.3.5 lib/generators/json_voorhees/app_make_user/templates/user/user_model.rb
json_voorhees-0.3.0 lib/generators/json_voorhees/app_make_user/templates/user/user_model.rb