ID8_History
{{ resolvedDiscussionCount }}/{{ discussionCount }} {{ resolvedCountText }} resolved
-
-
-
-
-
-
17 18 end 18 19 19 20 def detail 20 session[:params_job_id] = params[:id] 21 21 @job = Job.find(params[:id]).decorate 22 session[:params_job_id] = @job.id -
Master
Có thể dùng cookie cho các job đã xem được không ?
Có khác biệt gì so với dùng session
-
-
-
-
-
3 3 # Job controller 4 4 class JobController < ApplicationController 5 5 before_action :load_data_dropdown, only: :index 6 # after_action :add_job_to_history, only: :detail 6 def add_job_to_history(job_id) 7 return unless user_signed_in? 7 8 8 def add_job_to_history 9 current_user.histories.create(session[:params_job_id]) if user_signed_in? 10 session.delete(:params_job_id) 9 current_user.histories.find_or_create_by(job_id: job_id) 10 counter_history = current_user.histories.count 11 current_user.histories.destroy(current_user.histories.first) if counter_history > History::NUMBER_JOB_LIMIT -
Master
Đoạn xử lý trong action này nên đưa vào
libvì là business logic -
-
-
17 18 end 18 19 19 20 def detail 20 session[:params_job_id] = params[:id] 21 21 @job = Job.find(params[:id]).decorate 22 return render 'error/fage_not_found' if @job.blank? 23 24 add_job_to_history(@job.id) -
Master
Action này có thể đưa vào
lib -
-
-
Toggle commit list
-
lib/business/job_business.rb 0 → 100644
1 # frozen_string_literal: true 2 3 class JobBusiness -
Master
JobBusiness=>JobHistory -
-
-
-
Toggle commit list
-
merged
Toggle commit list