Sha256: 4e4512d029d134f7e6e34a758c60d9252898bcd1fe5509dc6840880240830412

Contents?: true

Size: 776 Bytes

Versions: 8

Compression:

Stored size: 776 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, :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

  <% if options.arcadex? %>
    def setup_user
    	create_token
    end

    def create_token
      self.tokens.create!
    end
  <% else %>
    def setup_user
    end
  <% end %>
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
json_voorhees-0.4.7 lib/generators/json_voorhees/app_make_user/templates/user/user_model.rb
json_voorhees-0.4.6 lib/generators/json_voorhees/app_make_user/templates/user/user_model.rb
json_voorhees-0.4.5 lib/generators/json_voorhees/app_make_user/templates/user/user_model.rb
json_voorhees-0.4.4 lib/generators/json_voorhees/app_make_user/templates/user/user_model.rb
json_voorhees-0.4.3 lib/generators/json_voorhees/app_make_user/templates/user/user_model.rb
json_voorhees-0.4.2 lib/generators/json_voorhees/app_make_user/templates/user/user_model.rb
json_voorhees-0.4.1 lib/generators/json_voorhees/app_make_user/templates/user/user_model.rb
json_voorhees-0.4.0 lib/generators/json_voorhees/app_make_user/templates/user/user_model.rb