Sha256: 50334210ebd07931a58ffdacf8c2344e8be6468979a7d23dcfc6ba0f33c9fa9b

Contents?: true

Size: 527 Bytes

Versions: 1

Compression:

Stored size: 527 Bytes

Contents

class User < ActiveRecord::Base
  belongs_to :role
  before_create :add_user_role
  # Include default devise modules. Others available are:
  # :confirmable, :lockable, :timeoutable and :omniauthable
  devise :database_authenticatable, :registerable,
         :recoverable, :rememberable, :trackable, :validatable

  
  def name
    "#{first_name} #{last_name}"
  end

  def role_symbols
      [role.title.to_sym]
  end

  private

  def add_user_role
    self.role = Role.find_by_title 'user'
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
caseadilla-0.0.1 lib/generators/caseadilla/install/templates/app/models/user.rb