Sha256: 6961381095473d9996cb387b6d3148b042233ad015fa9924ce08245c2c05dd97

Contents?: true

Size: 961 Bytes

Versions: 7

Compression:

Stored size: 961 Bytes

Contents

class <%= class_name %> < ActiveRecord::Base
<%- if options.friendly? -%>
  include FriendlyId
  friendly_id :email, use: [:slugged]

<%- end -%>
<%- if options.language? -%>
  belongs_to :language

<%- end -%>
  authenticates_with_sorcery!
  validates :email, presence: true, uniqueness: { case_sensitive: false }
  validates :password, presence: true, on: :create
  validates :password, length: { minimum: 6 }, unless: Proc.new { |a| a.password.blank? }
  validates :password, confirmation: true
  validates :password_confirmation, presence: true, on: :create
<%- if options.authority? -%>
  include Authority::UserAbilities
<%- end -%>

  default_scope { order(:name) }
  scope :active,  -> { where(active: true) }
  scope :sysadms, -> { where(sysadm: true) }
  
<%- if options.picture? -%>
  mount_uploader :picture, PictureUploader

<%- end -%>
  extend Enumerize
  enumerize :theme, in: BootswatchRails::THEMES
  # enum theme: BootswatchRails::THEMES
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
bootswatch_rails-3.3.7.8 lib/generators/bootswatch_rails/sorcery/templates/user_model.rb
bootswatch_rails-3.3.7.7 lib/generators/bootswatch_rails/sorcery/templates/user_model.rb
bootswatch_rails-3.3.7.6 lib/generators/bootswatch_rails/sorcery/templates/user_model.rb
bootswatch_rails-3.3.7.5 lib/generators/bootswatch_rails/sorcery/templates/user_model.rb
bootswatch_rails-3.3.7.4 lib/generators/bootswatch_rails/sorcery/templates/user_model.rb
bootswatch_rails-3.3.7.3 lib/generators/bootswatch_rails/sorcery/templates/user_model.rb
bootswatch_rails-3.3.7.2 lib/generators/bootswatch_rails/sorcery/templates/user_model.rb