Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
V
VeNJOB
Overview
Overview
Details
Activity
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Nguyen Ngoc Nghia
VeNJOB
Commits
dd0b8447
Commit
dd0b8447
authored
Jul 28, 2020
by
Nguyen Ngoc Nghia
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix reviews
parent
de91696f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
1 deletions
+8
-1
app/controllers/favorites_controller.rb
+7
-0
app/helpers/job_helper.rb
+1
-1
No files found.
app/controllers/favorites_controller.rb
View file @
dd0b8447
...
...
@@ -5,12 +5,19 @@ class FavoritesController < ApplicationController
redirect_to
jobs_path
if
params
[
:job_id
].
blank?
job_id
=
params
[
:job_id
]
get_user_job
=
get_user_job
if
get_user_job
@favorite_jobs
=
get_user_job
.
update
(
favorited_at:
Time
.
current
)
else
@favorite_jobs
=
UserJob
.
create!
(
user_id:
current_user
.
id
,
job_id:
job_id
,
favorited_at:
Time
.
current
)
end
@favorite_job
=
UserJob
.
find_or_initialize_by
(
user_id:
current_user
.
id
,
job_id:
job_id
)
unless
@favorite_job
.
save!
render
json:
{}
end
redirect_to
job_path
(
job_id
)
end
...
...
app/helpers/job_helper.rb
View file @
dd0b8447
...
...
@@ -13,6 +13,6 @@ module JobHelper
end
def
verify_applied_job
UserJob
.
where
.
not
(
applied_at:
nil
).
find_by
(
user_id:
current_user
.
id
,
job_id:
@job
.
id
)
UserJob
.
find_by
(
user_id:
current_user
.
id
,
job_id:
@job
.
id
)
&
.
applied_at
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