From 8818aa680c2ddaf1204e297fe27f088499eea74f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miquel=20Sabat=C3=A9=20Sol=C3=A0?= Date: Thu, 14 Mar 2024 22:17:12 +0100 Subject: [PATCH] Dropped redundant 'location' column MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Looks like I messed up later on and kept two columns which were basically referring to the same thing. Signed-off-by: Miquel Sabaté Solà --- app/controllers/things_controller.rb | 4 ++-- app/models/thing.rb | 1 - app/views/things/_form.html.erb | 5 ----- config/locales/ca.yml | 1 - config/locales/en.yml | 1 - db/migrate/20240314211609_drop_location_column.rb | 5 +++++ db/schema.rb | 3 +-- test/fixtures/things.yml | 2 -- 8 files changed, 8 insertions(+), 14 deletions(-) create mode 100644 db/migrate/20240314211609_drop_location_column.rb diff --git a/app/controllers/things_controller.rb b/app/controllers/things_controller.rb index 450b409..e994a3d 100644 --- a/app/controllers/things_controller.rb +++ b/app/controllers/things_controller.rb @@ -63,7 +63,7 @@ def set_thing def thing_params params.require(:thing).permit(:target, :title, :publisher, :address, :year, :url, :access, - :authors, :location, :insideof, :pages, :rate, :status, :kind, - :bought_at, :editors, :note, :where_is_it, tag_ids: []) + :authors, :insideof, :pages, :rate, :status, :kind, :bought_at, + :editors, :note, :where_is_it, tag_ids: []) end end diff --git a/app/models/thing.rb b/app/models/thing.rb index 5c758fb..1f1e4e4 100644 --- a/app/models/thing.rb +++ b/app/models/thing.rb @@ -23,7 +23,6 @@ def self.like(text:) .or(where('publisher LIKE ?', "%#{text}%")) .or(where('address LIKE ?', "%#{text}%")) .or(where('url LIKE ?', "%#{text}%")) - .or(where('location LIKE ?', "%#{text}%")) .or(where('insideof LIKE ?', "%#{text}%")) .or(where('pages LIKE ?', "%#{text}%")) .or(where('note LIKE ?', "%#{text}%")) diff --git a/app/views/things/_form.html.erb b/app/views/things/_form.html.erb index da90302..0569cc4 100644 --- a/app/views/things/_form.html.erb +++ b/app/views/things/_form.html.erb @@ -49,11 +49,6 @@ <%= form.date_field :access %> -
- <%= form.label :location %> - <%= form.text_field :location %> -
-
<%= form.label :insideof %> <%= form.text_field :insideof %> diff --git a/config/locales/ca.yml b/config/locales/ca.yml index 0e293b4..15a110d 100644 --- a/config/locales/ca.yml +++ b/config/locales/ca.yml @@ -20,7 +20,6 @@ ca: year: Any url: Enllaç access: Última data de consulta - location: Lloc insideof: Dins de pages: Pàgines rate: Qualificació diff --git a/config/locales/en.yml b/config/locales/en.yml index c1b0d07..2209eee 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -20,7 +20,6 @@ en: year: Year url: URL access: Last consulted at - location: Place insideof: Inside of pages: Pages rate: Rate diff --git a/db/migrate/20240314211609_drop_location_column.rb b/db/migrate/20240314211609_drop_location_column.rb new file mode 100644 index 0000000..1afa57f --- /dev/null +++ b/db/migrate/20240314211609_drop_location_column.rb @@ -0,0 +1,5 @@ +class DropLocationColumn < ActiveRecord::Migration[7.1] + def change + remove_column :things, :location + end +end diff --git a/db/schema.rb b/db/schema.rb index 967b074..8726291 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[7.1].define(version: 2024_03_13_133513) do +ActiveRecord::Schema[7.1].define(version: 2024_03_14_211609) do create_table "action_text_rich_texts", force: :cascade do |t| t.string "name", null: false t.text "body" @@ -94,7 +94,6 @@ t.integer "year" t.string "url" t.date "access" - t.string "location" t.string "insideof" t.string "pages" t.integer "user_id", null: false diff --git a/test/fixtures/things.yml b/test/fixtures/things.yml index 069cf85..85a6359 100644 --- a/test/fixtures/things.yml +++ b/test/fixtures/things.yml @@ -7,7 +7,6 @@ thing1: address: year: 2024 url: 'http://example.com' - location: 'Somewhere' insideof: 'Some other thing' pages: '22-24' note: 'This is a note 1' @@ -27,7 +26,6 @@ thing2: address: 'Address 2' year: 2024 url: 'http://example.com' - location: 'Somewhere' insideof: 'Some other thing' pages: '22-24' note: 'This is a note 2'