Skip to content

Commit

Permalink
Merge pull request #14 from recroot89/fix/update_resume_education_wor…
Browse files Browse the repository at this point in the history
…k_fields

update resume education and work fields
  • Loading branch information
mokevnin committed Sep 7, 2019
2 parents d2e4db0 + c58770a commit db4f34f
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 15 deletions.
4 changes: 2 additions & 2 deletions app/controllers/web/account/resumes_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def destroy; end

def resume_params
attrs = %i[name github_url summary skills_description awards_description english_fluency]
params.require(:resume).permit(*attrs, educations_attributes: %i[institution degree faculty start_date end_date],
works_attributes: %i[company position description start_date end_date])
params.require(:resume).permit(*attrs, educations_attributes: %i[institution faculty begin_date end_date],
works_attributes: %i[company position description begin_date end_date])
end
end
4 changes: 2 additions & 2 deletions app/views/web/account/resumes/_education_fields.html.slim
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.nested-fields
= f.input :institution
= f.input :degree
= f.input :start_date, as: :date, html5: true
= f.input :faculty
= f.input :begin_date, as: :date, html5: true
= f.input :end_date, as: :date, html5: true
= link_to_remove_association "Remove education", f
2 changes: 1 addition & 1 deletion app/views/web/account/resumes/_work_fields.html.slim
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
.nested-fields
= f.input :company
= f.input :position
= f.input :start_date, as: :date, html5: true
= f.input :begin_date, as: :date, html5: true
= f.input :end_date, as: :date, html5: true
= f.input :description, as: :text
= link_to_remove_association "Remove work", f
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# frozen_string_literal: true

class UpdateResumeWorksAndEducationsFields < ActiveRecord::Migration[6.0]
def change
change_table :resume_educations do |t|
t.remove :degree
t.rename :start_date, :begin_date
end

rename_column :resume_works, :start_date, :begin_date
end
end
7 changes: 3 additions & 4 deletions db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema.define(version: 2019_09_06_211027) do
ActiveRecord::Schema.define(version: 2019_09_07_190345) do

create_table "resume_answer_likes", force: :cascade do |t|
t.integer "resume_id", null: false
Expand All @@ -36,9 +36,8 @@
create_table "resume_educations", force: :cascade do |t|
t.integer "resume_id", null: false
t.string "institution"
t.string "degree"
t.string "faculty"
t.date "start_date"
t.date "begin_date"
t.date "end_date"
t.datetime "created_at", precision: 6, null: false
t.datetime "updated_at", precision: 6, null: false
Expand All @@ -49,7 +48,7 @@
t.integer "resume_id", null: false
t.string "company"
t.string "position"
t.date "start_date"
t.date "begin_date"
t.date "end_date"
t.string "description"
t.datetime "created_at", precision: 6, null: false
Expand Down
6 changes: 2 additions & 4 deletions test/fixtures/resume/educations.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,13 @@
one:
resume: one
institution: MyString
degree: MyString
faculty: MyString
start_date: 2010-09-01
begin_date: 2010-09-01
end_date: 2014-07-01

two:
resume: two
institution: MyString
degree: MyString
faculty: MyString
start_date: 2014-09-01
begin_date: 2014-09-01
end_date: 2018-07-01
4 changes: 2 additions & 2 deletions test/fixtures/resume/works.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ one:
resume: one
company: MyString
position: MyString
start_date: 2015-09-07
begin_date: 2015-09-07
end_date: 2019-09-07
description: MyString

two:
resume: two
company: MyString
position: MyString
start_date: 2018-09-07
begin_date: 2018-09-07
end_date: 2019-09-07
description: MyString

0 comments on commit db4f34f

Please sign in to comment.