Commit 5c77f39a by Mai Hoang Thai Ha

fixed controller

parent 87d06493
...@@ -2,11 +2,8 @@ class AppliesController < ApplicationController ...@@ -2,11 +2,8 @@ class AppliesController < ApplicationController
before_action :load_job, only: %i[new confirm create] before_action :load_job, only: %i[new confirm create]
def new def new
@apply = if back? build_params = session[:apply_job] if use_apply_job_session?
ApplyJob.new(session[:apply_job]) @apply = current_user.apply_jobs.build(build_params)
else
current_user.apply_jobs.build
end
end end
def confirm def confirm
...@@ -51,7 +48,7 @@ class AppliesController < ApplicationController ...@@ -51,7 +48,7 @@ class AppliesController < ApplicationController
@current_user ||= User.first @current_user ||= User.first
end end
def back? def use_apply_job_session?
request.referer&.include?('confirm') && session[:apply_job].present? request.referer&.include?('confirm') && session[:apply_job].present?
end end
end end
...@@ -15,5 +15,6 @@ p ...@@ -15,5 +15,6 @@ p
| Full name: #{@apply.user_name} | Full name: #{@apply.user_name}
p p
| Email: #{@apply.email} | Email: #{@apply.email}
p CV: p
| CV: #{url_for(@apply.cv)}
p Best, p Best,
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment