Commit 28961f12 by Xuan Trung Le Committed by Xuan Trung Le

fix bugs

parent a5373b87
......@@ -7,11 +7,8 @@ class JobsController < ApplicationController
end
def show
<<<<<<< 28f7fab9b8eeffd0552745bdf048484097ac3362
clear_session_candidate
=======
current_user.view(Job.find(params[:id])) if current_user
>>>>>>> add history page
end
def city
......
......@@ -37,22 +37,14 @@ class User < ApplicationRecord
liked_jobs.include?(job)
end
private
def password_required?
return false if skip_validation
super
end
def view(job)
viewed_jobs << job unless viewed_jobs.include?(job)
end
def like(job)
liked_jobs << job unless liked_jobs.include?(job)
end
private
def unlike(job)
liked_jobs.delete(job.id)
def password_required?
return false if skip_validation
super
end
end
class UsersJob < ApplicationRecord
belongs_to :user
belongs_to :job
end
class CreateUsersJobs < ActiveRecord::Migration[5.1]
def change
create_table :users_jobs do |t|
t.references :user, foreign_key: true
t.references :job, foreign_key: true
t.string :action
t.timestamps
end
end
end
......@@ -10,11 +10,12 @@
#
# It's strongly recommended that you check this file into your version control system.
<<<<<<< 28f7fab9b8eeffd0552745bdf048484097ac3362
ActiveRecord::Schema.define(version: 20171018012604) do
=======
<<<<<<< Updated upstream
ActiveRecord::Schema.define(version: 20171024093324) do
>>>>>>> add history page
=======
ActiveRecord::Schema.define(version: 20171018012604) do
>>>>>>> Stashed changes
create_table "apply_jobs", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" do |t|
t.bigint "job_id"
......@@ -130,16 +131,4 @@ ActiveRecord::Schema.define(version: 20171024093324) do
t.index ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true
end
create_table "users_jobs", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" do |t|
t.bigint "user_id"
t.bigint "job_id"
t.string "action"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.index ["job_id"], name: "index_users_jobs_on_job_id"
t.index ["user_id"], name: "index_users_jobs_on_user_id"
end
add_foreign_key "users_jobs", "jobs"
add_foreign_key "users_jobs", "users"
end
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