-
data-no-instant="true">all
+
data-no-instant="true">all
<% categories_for_display.each do |cat| %>
-
data-no-instant="true"><%= cat[:name] %>
+
data-no-instant="true"><%= cat[:name] %>
<% end %>
-
Create a Listing
+
Create a Listing
<% if @displayed_classified_listing %>
<% end %>
diff --git a/config/routes.rb b/config/routes.rb
index 3681f0602..07075e7ab 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -238,7 +238,7 @@ Rails.application.routes.draw do
get "/search/reactions" => "search#reactions"
get "/chat_channel_memberships/find_by_chat_channel_id" => "chat_channel_memberships#find_by_chat_channel_id"
get "/listings/dashboard" => "classified_listings#dashboard"
- get "/listings/:category" => "classified_listings#index"
+ get "/listings/:category" => "classified_listings#index", :as => :classified_listing_category
get "/listings/:category/:slug" => "classified_listings#index", :as => :classified_listing_slug
get "/listings/:category/:slug/:view" => "classified_listings#index",
:constraints => { view: /moderate/ }
diff --git a/db/migrate/20200501032629_remove_category_from_classified_listing.rb b/db/migrate/20200501032629_remove_category_from_classified_listing.rb
new file mode 100644
index 000000000..3d5ba0f74
--- /dev/null
+++ b/db/migrate/20200501032629_remove_category_from_classified_listing.rb
@@ -0,0 +1,5 @@
+class RemoveCategoryFromClassifiedListing < ActiveRecord::Migration[5.2]
+ def change
+ safety_assured { remove_column :classified_listings, :category }
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index 0ec913ece..41dd91f2d 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_04_26_124118) do
+ActiveRecord::Schema.define(version: 2020_05_01_032629) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
@@ -308,7 +308,6 @@ ActiveRecord::Schema.define(version: 2020_04_26_124118) do
t.string "slug"
t.string "status", default: "active"
t.datetime "updated_at", null: false
- t.index ["slug"], name: "index_chat_channels_on_slug", unique: true
end
create_table "classified_listing_categories", force: :cascade do |t|
@@ -326,7 +325,6 @@ ActiveRecord::Schema.define(version: 2020_04_26_124118) do
t.text "body_markdown"
t.datetime "bumped_at"
t.string "cached_tag_list"
- t.string "category"
t.bigint "classified_listing_category_id"
t.boolean "contact_via_connect", default: false
t.datetime "created_at", null: false
diff --git a/db/seeds.rb b/db/seeds.rb
index 1315bf814..34a33b2cd 100644
--- a/db/seeds.rb
+++ b/db/seeds.rb
@@ -379,7 +379,7 @@ CATEGORIES = [
slug: "cfp",
cost: 1,
name: "Conference CFP",
- rules: "Currently open for proposals,with link to form."
+ rules: "Currently open for proposals, with link to form."
},
{
slug: "education",
diff --git a/spec/requests/api/v0/classified_listings_spec.rb b/spec/requests/api/v0/classified_listings_spec.rb
index 830f7b6bc..3de04c749 100644
--- a/spec/requests/api/v0/classified_listings_spec.rb
+++ b/spec/requests/api/v0/classified_listings_spec.rb
@@ -117,7 +117,7 @@ RSpec.describe "Api::V0::ClassifiedListings", type: :request do
it "does not return unpublished listings" do
category = "cfp"
- listing = user1.classified_listings.where(category: category)
+ listing = user1.classified_listings.in_category(category).last
listing.update(published: false)
get api_classified_listings_category_path(category)