Commit 5336f4c6 by Xuan Trung Le

fix bugs

parent 5442911b
......@@ -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
......
......@@ -13,23 +13,22 @@ class User < ApplicationRecord
# Include default devise modules. Others available are:
# :confirmable, :lockable, :timeoutable and :omniauthable
devise :database_authenticatable, :registerable,
<<<<<<< 28f7fab9b8eeffd0552745bdf048484097ac3362
:recoverable, :rememberable, :trackable, :validatable, :confirmable
:recoverable, :rememberable, :trackable, :validatable, :confirmable
# CarrierWave
mount_uploader :cv, CvUploader
# Validate
validates :email, presence: true, length: {maximum: 200}
validates :name, presence: true, length: {maximum: 200}, unless: :skip_validation
validates_size_of :cv, maximum: 5.megabytes, message: "size should be less than 5MB"
validates :email, presence: true, length: { maximum: 200 }
validates :name, presence: true, length: { maximum: 200 }, unless: :skip_validation
validates_size_of :cv, maximum: 5.megabytes, message: 'size should be less than 5MB'
private
def password_required?
return false if skip_validation
super
=======
:recoverable, :rememberable, :trackable, :validatable
end
def view(job)
viewed_jobs << job unless viewed_jobs.include?(job)
......@@ -41,6 +40,5 @@ class User < ApplicationRecord
def unlike(job)
liked_jobs.delete(job.id)
>>>>>>> add history page
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