Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
candi-date-tayo
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
George Nicole Balmaceda
candi-date-tayo
Commits
f00bfcee
Commit
f00bfcee
authored
Jul 18, 2016
by
Alexander Hans Collado Jr.
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added user authentication
parent
13d69d6a
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
85 additions
and
1 deletion
+85
-1
user.rb
app/models/user.rb
+6
-0
routes.rb
config/routes.rb
+1
-0
20160718134705_devise_create_users.rb
db/migrate/20160718134705_devise_create_users.rb
+42
-0
schema.rb
db/schema.rb
+18
-1
users.yml
test/fixtures/users.yml
+11
-0
user_test.rb
test/models/user_test.rb
+7
-0
No files found.
app/models/user.rb
0 → 100644
View file @
f00bfcee
class
User
<
ApplicationRecord
# Include default devise modules. Others available are:
# :confirmable, :lockable, :timeoutable and :omniauthable
devise
:database_authenticatable
,
:registerable
,
:recoverable
,
:rememberable
,
:trackable
,
:validatable
end
config/routes.rb
View file @
f00bfcee
Rails
.
application
.
routes
.
draw
do
Rails
.
application
.
routes
.
draw
do
devise_for
:users
# For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
# For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
end
end
db/migrate/20160718134705_devise_create_users.rb
0 → 100644
View file @
f00bfcee
class
DeviseCreateUsers
<
ActiveRecord
::
Migration
[
5.0
]
def
change
create_table
:users
do
|
t
|
## Database authenticatable
t
.
string
:email
,
null:
false
,
default:
""
t
.
string
:encrypted_password
,
null:
false
,
default:
""
## Recoverable
t
.
string
:reset_password_token
t
.
datetime
:reset_password_sent_at
## Rememberable
t
.
datetime
:remember_created_at
## Trackable
t
.
integer
:sign_in_count
,
default:
0
,
null:
false
t
.
datetime
:current_sign_in_at
t
.
datetime
:last_sign_in_at
t
.
string
:current_sign_in_ip
t
.
string
:last_sign_in_ip
## Confirmable
# t.string :confirmation_token
# t.datetime :confirmed_at
# t.datetime :confirmation_sent_at
# t.string :unconfirmed_email # Only if using reconfirmable
## Lockable
# t.integer :failed_attempts, default: 0, null: false # Only if lock strategy is :failed_attempts
# t.string :unlock_token # Only if unlock strategy is :email or :both
# t.datetime :locked_at
t
.
timestamps
null:
false
end
add_index
:users
,
:email
,
unique:
true
add_index
:users
,
:reset_password_token
,
unique:
true
# add_index :users, :confirmation_token, unique: true
# add_index :users, :unlock_token, unique: true
end
end
db/schema.rb
View file @
f00bfcee
...
@@ -10,7 +10,24 @@
...
@@ -10,7 +10,24 @@
#
#
# It's strongly recommended that you check this file into your version control system.
# It's strongly recommended that you check this file into your version control system.
ActiveRecord
::
Schema
.
define
(
version:
20160718134153
)
do
ActiveRecord
::
Schema
.
define
(
version:
20160718134705
)
do
create_table
"users"
,
force: :cascade
do
|
t
|
t
.
string
"email"
,
default:
""
,
null:
false
t
.
string
"encrypted_password"
,
default:
""
,
null:
false
t
.
string
"reset_password_token"
t
.
datetime
"reset_password_sent_at"
t
.
datetime
"remember_created_at"
t
.
integer
"sign_in_count"
,
default:
0
,
null:
false
t
.
datetime
"current_sign_in_at"
t
.
datetime
"last_sign_in_at"
t
.
string
"current_sign_in_ip"
t
.
string
"last_sign_in_ip"
t
.
datetime
"created_at"
,
null:
false
t
.
datetime
"updated_at"
,
null:
false
t
.
index
[
"email"
],
name:
"index_users_on_email"
,
unique:
true
t
.
index
[
"reset_password_token"
],
name:
"index_users_on_reset_password_token"
,
unique:
true
end
create_table
"votes"
,
force: :cascade
do
|
t
|
create_table
"votes"
,
force: :cascade
do
|
t
|
t
.
integer
"user_id"
t
.
integer
"user_id"
...
...
test/fixtures/users.yml
0 → 100644
View file @
f00bfcee
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
# This model initially had no columns defined. If you add columns to the
# model remove the '{}' from the fixture names and add the columns immediately
# below each fixture, per the syntax in the comments below
#
one
:
{}
# column: value
#
two
:
{}
# column: value
test/models/user_test.rb
0 → 100644
View file @
f00bfcee
require
'test_helper'
class
UserTest
<
ActiveSupport
::
TestCase
# test "the truth" do
# assert true
# end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment