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 Hoang Mai Phuong
VeNJOB
Commits
1bf09fb6
Commit
1bf09fb6
authored
Aug 16, 2021
by
Nguyen Hoang Mai Phuong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
check-present-session-blob-id
parent
769fc198
Pipeline
#1394
failed with stages
in 0 seconds
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
4 deletions
+6
-4
app/controllers/apply_jobs_controller.rb
+6
-4
No files found.
app/controllers/apply_jobs_controller.rb
View file @
1bf09fb6
...
...
@@ -6,8 +6,10 @@ class ApplyJobsController < ApplicationController
if
session
[
:apply_job
].
present?
@apply_job
=
ApplyJob
.
new
(
session
[
:apply_job
])
@blob
=
ActiveStorage
::
Blob
.
find
(
session
[
:id
])
if
session
[
:blob_id
].
present?
@blob
=
ActiveStorage
::
Blob
.
find
(
session
[
:blob_id
])
@apply_job
.
assign_attributes
(
cv:
@blob
)
end
else
@apply_job
=
ApplyJob
.
new
end
...
...
@@ -23,7 +25,7 @@ class ApplyJobsController < ApplicationController
filename:
apply_params
[
:cv
].
original_filename
,
content_type:
apply_params
[
:cv
].
content_type
)
session
[
:id
]
=
@blob
.
id
session
[
:
blob_
id
]
=
@blob
.
id
session
[
:apply_job
]
=
@apply_job
else
render
:new
...
...
@@ -34,7 +36,7 @@ class ApplyJobsController < ApplicationController
@apply_job
=
ApplyJob
.
new
(
apply_params
)
@apply_job
.
user_id
=
User
.
find_by
(
id:
1
).
id
@job
=
Job
.
latest_jobs
.
find
(
apply_params
[
:job_id
])
@apply_job
.
cv
=
ActiveStorage
::
Blob
.
find
(
session
[
:id
])
@apply_job
.
cv
=
ActiveStorage
::
Blob
.
find
(
session
[
:
blob_
id
])
if
@apply_job
.
save
ApplyJobMailer
.
with
(
apply_job:
@apply_job
,
job:
@job
).
create_apply
.
deliver_now
flash
.
now
[
:success
]
=
'You have applied successfully'
...
...
@@ -43,7 +45,7 @@ class ApplyJobsController < ApplicationController
redirect_to
root_url
end
session
[
:apply_job
]
=
nil
session
[
:id
]
=
nil
session
[
:
blob_
id
]
=
nil
end
private
...
...
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