diff --git a/app/models/article.rb b/app/models/article.rb index e96ddc240..678d08b5d 100644 --- a/app/models/article.rb +++ b/app/models/article.rb @@ -19,7 +19,6 @@ class Article < ApplicationRecord delegate :username, to: :user, prefix: true belongs_to :user - belongs_to :job_opportunity, optional: true belongs_to :organization, optional: true # touch: true was removed because when an article is updated, the associated collection # is touched along with all its articles(including this one). This causes eventually a deadlock. diff --git a/app/models/job_opportunity.rb b/app/models/job_opportunity.rb deleted file mode 100644 index 4e9044475..000000000 --- a/app/models/job_opportunity.rb +++ /dev/null @@ -1,16 +0,0 @@ -class JobOpportunity < ApplicationRecord - REMOTENESS_PHRASES = { - "on_premise" => "In Office", - "fully_remote" => "Fully Remote", - "remote_optional" => "Remote Optional", - "on_premise_flexible" => "Mostly in Office but Flexible" - }.freeze - - has_many :articles - - validates :remoteness, inclusion: { in: REMOTENESS_PHRASES.keys } - - def remoteness_in_words - REMOTENESS_PHRASES[remoteness] - end -end diff --git a/db/migrate/20200329103305_drop_job_opportunities.rb b/db/migrate/20200329103305_drop_job_opportunities.rb new file mode 100644 index 000000000..6af5eb013 --- /dev/null +++ b/db/migrate/20200329103305_drop_job_opportunities.rb @@ -0,0 +1,17 @@ +class DropJobOpportunities < ActiveRecord::Migration[5.2] + def change + drop_table :job_opportunities do |t| + t.string :experience_level + t.string :location_city + t.string :location_country_code + t.string :location_given + t.decimal :location_lat, precision: 10, scale: 6 + t.decimal :location_long, precision: 10, scale: 6 + t.string :location_postal_code + t.string :permanency + t.string :remoteness + t.string :time_commitment + t.timestamps + end + end +end diff --git a/db/schema.rb b/db/schema.rb index 1b3644703..1dc6fcb3c 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 2020_03_26_111645) do +ActiveRecord::Schema.define(version: 2020_03_29_103305) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -569,21 +569,6 @@ ActiveRecord::Schema.define(version: 2020_03_26_111645) do t.index ["provider", "user_id"], name: "index_identities_on_provider_and_user_id", unique: true end - create_table "job_opportunities", force: :cascade do |t| - t.datetime "created_at", null: false - t.string "experience_level" - t.string "location_city" - t.string "location_country_code" - t.string "location_given" - t.decimal "location_lat", precision: 10, scale: 6 - t.decimal "location_long", precision: 10, scale: 6 - t.string "location_postal_code" - t.string "permanency" - t.string "remoteness" - t.string "time_commitment" - t.datetime "updated_at", null: false - end - create_table "mentions", id: :serial, force: :cascade do |t| t.datetime "created_at", null: false t.integer "mentionable_id" diff --git a/spec/models/job_opportunity_spec.rb b/spec/models/job_opportunity_spec.rb deleted file mode 100644 index b73df9219..000000000 --- a/spec/models/job_opportunity_spec.rb +++ /dev/null @@ -1,56 +0,0 @@ -require "rails_helper" - -RSpec.describe JobOpportunity, type: :model do - let(:job_opportunity) { described_class.new(remoteness: "on_premise") } - - context "when validations" do - describe "#remoteness" do - it "is valid with on_premise" do - job_opportunity.remoteness = "on_premise" - expect(job_opportunity).to be_valid - end - - it "is valid with fully_remote" do - job_opportunity.remoteness = "fully_remote" - expect(job_opportunity).to be_valid - end - - it "is valid with remote_optional" do - job_opportunity.remoteness = "remote_optional" - expect(job_opportunity).to be_valid - end - - it "is valid with on_premise_flexible" do - job_opportunity.remoteness = "on_premise_flexible" - expect(job_opportunity).to be_valid - end - - it "is not valid an arbitrary word" do - job_opportunity.remoteness = "foobar" - expect(job_opportunity).not_to be_valid - end - end - end - - describe "#remoteness_in_words" do - it "returns remoteness in words for on_premise" do - job_opportunity.remoteness = "on_premise" - expect(job_opportunity.remoteness_in_words).to eq("In Office") - end - - it "returns remoteness in words for fully_remote" do - job_opportunity.remoteness = "fully_remote" - expect(job_opportunity.remoteness_in_words).to eq("Fully Remote") - end - - it "returns remoteness in words for remote_optional" do - job_opportunity.remoteness = "remote_optional" - expect(job_opportunity.remoteness_in_words).to eq("Remote Optional") - end - - it "returns remoteness in words for on_premise_flexible" do - job_opportunity.remoteness = "on_premise_flexible" - expect(job_opportunity.remoteness_in_words).to eq("Mostly in Office but Flexible") - end - end -end