curly-happiness/app/models/user.rb

28 lines
1.3 KiB
Ruby

class User < ApplicationRecord
############################################################################################
## PeterGate Roles ##
## The :user role is added by default and shouldn't be included in this list. ##
## The :root_admin can access any page regardless of access settings. Use with caution! ##
## The multiple option can be set to true if you need users to have multiple roles. ##
petergate(roles: [:admin, ], multiple: false) ##
############################################################################################
#For internal messaging between sender and receiver
has_many :conversations, :foreign_key => :sender_id
def create
# Create the user from params
@user = User.new(params[:user])
if @user.save
# Deliver the signup email
UserNotifier.send_signup_email(@user).deliver
redirect_to(@user, :notice => 'User created')
else
render :action => 'new'
end
end
# Include default devise modules. Others available are:
# :confirmable, :lockable, :timeoutable and :omniauthable
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable
end