Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Patricio Sanchez
/
quiniela-mundial
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
psanchezp
2018-06-08 17:43:45 -0500
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
4f0d3d5078f73392b02524574b05c1f4bae103cd
4f0d3d50
1 parent
382b73c3
User score
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
0 deletions
app/models/user.rb
app/models/user.rb
View file @
4f0d3d5
...
...
@@ -26,6 +26,8 @@ class User < ApplicationRecord
before_save
:encrypt_password
has_many
:bets
,
inverse_of: :user
has_and_belongs_to_many
:roles
,
inverse_of: :users
,
class_name:
'HeimdallEngine::Role'
,
join_table:
'users_roles'
,
...
...
@@ -33,6 +35,10 @@ class User < ApplicationRecord
association_foreign_key:
"role_id"
def
user_score
bets
.
active
.
sum
:points
end
def
encrypt_password
return
unless
password
.
present?
self
.
password_salt
=
BCrypt
::
Engine
.
generate_salt
.
force_encoding
(
'UTF-8'
)
...
...
Please
register
or
login
to post a comment