Sha256: 37693a141108e3468aa602a6720af82b5b4657d94beb32023080f899acb5b929

Contents?: true

Size: 1.52 KB

Versions: 1

Compression:

Stored size: 1.52 KB

Contents

# == Schema Information
#
# Table name: users
#
#  id                     :integer          not null, primary key
#  email                  :string(255)
#  created_at             :datetime
#  updated_at             :datetime
#  encrypted_password     :string(255)      default(""), not null
#  reset_password_token   :string(255)
#  reset_password_sent_at :datetime
#  remember_created_at    :datetime
#  sign_in_count          :integer          default(0), not null
#  current_sign_in_at     :datetime
#  last_sign_in_at        :datetime
#  current_sign_in_ip     :string(255)
#  last_sign_in_ip        :string(255)
#  invitation_token       :string(255)
#  name                   :string(255)      not null
#

class User < ActiveRecord::Base
  has_many :project_users, dependent: :destroy
  has_many :projects, through: :project_users
  has_many :organization_users, dependent: :destroy
  has_many :organizations, through: :organization_users
  has_many :selections, class_name: Finish, foreign_key: "selected_by_id",
    dependent: :nullify
  has_many :comments, dependent: :destroy

  validates :name, presence: true, length: { maximum: 255 }

  # Include default devise modules. Others available are:
  # :confirmable, :lockable, :timeoutable and :omniauthable
  devise :database_authenticatable, :registerable,
         :recoverable, :rememberable, :trackable, :validatable


  def set_invitation_token!
    self.invitation_token = SecureRandom.uuid
    save!
  end

  def clear_invitation_token!
    self.invitation_token = nil
    save!
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
self_systeem-0.1.0 test/dummy_app/app/models/user.rb