Commit 0ebcc9ac by thanhnd

history_jobs doing

parent f302f7cb
Pipeline #600 failed with stages
in 0 seconds
class JobsController < ApplicationController class JobsController < ApplicationController
def show def show
@job_detail = Job.find_by_id(params[:id]) @job_detail = Job.find_by_id(params[:id])
HistoryJob.find_or_create_by(job_id: @job_detail.id, user_id: current_user)
end end
def index def index
......
class HistoryJob < ApplicationRecord
belongs_to :job
belongs_to :user
end
\ No newline at end of file
class CreateHistoryJobs < ActiveRecord::Migration[6.0]
def change
create_table :history_jobs do |t|
t.integer :user_id
t.integer :job_id
t.timestamps
end
end
end
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
# #
# It's strongly recommended that you check this file into your version control system. # It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 2020_03_09_014715) do ActiveRecord::Schema.define(version: 2020_05_05_042407) do
create_table "applied_jobs", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| create_table "applied_jobs", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
t.integer "user_id" t.integer "user_id"
...@@ -48,6 +48,13 @@ ActiveRecord::Schema.define(version: 2020_03_09_014715) do ...@@ -48,6 +48,13 @@ ActiveRecord::Schema.define(version: 2020_03_09_014715) do
t.index ["email"], name: "index_companies_on_email" t.index ["email"], name: "index_companies_on_email"
end end
create_table "history_jobs", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
t.integer "user_id"
t.integer "job_id"
t.datetime "created_at", precision: 6, null: false
t.datetime "updated_at", precision: 6, null: false
end
create_table "industries", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| create_table "industries", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
t.text "industry_name" t.text "industry_name"
t.string "industry_description" t.string "industry_description"
......
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