Commit 5336f4c6 by Xuan Trung Le

fix bugs

parent 5442911b
...@@ -7,11 +7,8 @@ class JobsController < ApplicationController ...@@ -7,11 +7,8 @@ class JobsController < ApplicationController
end end
def show def show
<<<<<<< 28f7fab9b8eeffd0552745bdf048484097ac3362
clear_session_candidate clear_session_candidate
=======
current_user.view(Job.find(params[:id])) if current_user current_user.view(Job.find(params[:id])) if current_user
>>>>>>> add history page
end end
def city def city
......
...@@ -13,23 +13,22 @@ class User < ApplicationRecord ...@@ -13,23 +13,22 @@ class User < ApplicationRecord
# Include default devise modules. Others available are: # Include default devise modules. Others available are:
# :confirmable, :lockable, :timeoutable and :omniauthable # :confirmable, :lockable, :timeoutable and :omniauthable
devise :database_authenticatable, :registerable, devise :database_authenticatable, :registerable,
<<<<<<< 28f7fab9b8eeffd0552745bdf048484097ac3362
:recoverable, :rememberable, :trackable, :validatable, :confirmable :recoverable, :rememberable, :trackable, :validatable, :confirmable
# CarrierWave # CarrierWave
mount_uploader :cv, CvUploader mount_uploader :cv, CvUploader
# Validate # Validate
validates :email, presence: true, length: {maximum: 200} validates :email, presence: true, length: { maximum: 200 }
validates :name, presence: true, length: {maximum: 200}, unless: :skip_validation 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_size_of :cv, maximum: 5.megabytes, message: 'size should be less than 5MB'
private private
def password_required? def password_required?
return false if skip_validation return false if skip_validation
super super
======= end
:recoverable, :rememberable, :trackable, :validatable
def view(job) def view(job)
viewed_jobs << job unless viewed_jobs.include?(job) viewed_jobs << job unless viewed_jobs.include?(job)
...@@ -41,6 +40,5 @@ class User < ApplicationRecord ...@@ -41,6 +40,5 @@ class User < ApplicationRecord
def unlike(job) def unlike(job)
liked_jobs.delete(job.id) liked_jobs.delete(job.id)
>>>>>>> add history page
end end
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 @@ ...@@ -10,11 +10,12 @@
# #
# 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.
<<<<<<< 28f7fab9b8eeffd0552745bdf048484097ac3362 <<<<<<< Updated upstream
ActiveRecord::Schema.define(version: 20171018012604) do
=======
ActiveRecord::Schema.define(version: 20171024093324) do 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| create_table "apply_jobs", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" do |t|
t.bigint "job_id" t.bigint "job_id"
...@@ -130,16 +131,4 @@ ActiveRecord::Schema.define(version: 20171024093324) do ...@@ -130,16 +131,4 @@ ActiveRecord::Schema.define(version: 20171024093324) do
t.index ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true t.index ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true
end 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 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