Skip to content

Remove deprecated attributes in posts table (closes #471) #492

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Apr 16, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions app/controllers/posts_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,8 @@ def set_user_id(p)
end

def post_params
permitted_fields = [:description, :end_on, :global, :joinable, :permanent,
:start_on, :title, :category_id, :user_id, :is_group,
:active, tag_list: []]
permitted_fields = [:description, :end_on, :start_on, :title, :category_id,
:user_id, :is_group, :active, tag_list: []]

params.fetch(resource, {}).permit(*permitted_fields).tap do |p|
set_user_id(p)
Expand Down
2 changes: 0 additions & 2 deletions config/locales/ca.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,6 @@ ca:
created_at: Creat
description: Descripció
end_on: Finalitza al
joinable: Es poden afegir altres
permanent: Permanent
start_on: Comença al
tag_list: Etiquetes
title: Títol
Expand Down
2 changes: 0 additions & 2 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,6 @@ en:
created_at: Created
description: Description
end_on: Ends on
joinable: Can join others
permanent: Permanent
start_on: Start on
tag_list: Tags
title: Title
Expand Down
2 changes: 0 additions & 2 deletions config/locales/es.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,6 @@ es:
created_at: Creado
description: Descripción
end_on: Termina el
joinable: Se puede unir otros
permanent: Permanente
start_on: Empieza el
tag_list: Etiquetas
title: Título
Expand Down
2 changes: 0 additions & 2 deletions config/locales/eu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,6 @@ eu:
created_at: Sortua
description: Deskribapena
end_on: Bukatuko da.
joinable: Beste batzuk gehi litezke.
permanent: Iraunkorra
start_on: Hasiko da
tag_list: Etiketa
title: Izenburua
Expand Down
2 changes: 0 additions & 2 deletions config/locales/gl.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,6 @@ gl:
created_at: Creado
description: Descrición
end_on: Termina en
joinable: Poden unirse outros
permanent: Permanente
start_on: Comezar
tag_list: Etiquetas
title: Título
Expand Down
2 changes: 0 additions & 2 deletions config/locales/pt-BR.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,6 @@ pt-BR:
created_at: Criado
description: Descrição
end_on: 'Terminar o '
joinable: É possível unir outros
permanent: Permanente
start_on: Começa o
tag_list: Etiquetas
title: Título
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
class RemoveDeprecatedAttributesFromPosts < ActiveRecord::Migration
def change
remove_column :posts, :permanent
remove_column :posts, :joinable
remove_column :posts, :global
end
end
5 changes: 5 additions & 0 deletions db/migrate/20190412163011_remove_user_joined_post_table.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class RemoveUserJoinedPostTable < ActiveRecord::Migration
def change
drop_table :user_joined_post
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In production this table contains just one record, I would say it was just a test.

end
end
10 changes: 1 addition & 9 deletions db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema.define(version: 20190322180602) do
ActiveRecord::Schema.define(version: 20190412163011) do

# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
Expand Down Expand Up @@ -141,9 +141,6 @@
t.text "description"
t.date "start_on"
t.date "end_on"
t.boolean "permanent"
t.boolean "joinable"
t.boolean "global"
t.datetime "created_at"
t.datetime "updated_at"
t.text "tags", array: true
Expand Down Expand Up @@ -179,11 +176,6 @@
add_index "transfers", ["operator_id"], name: "index_transfers_on_operator_id", using: :btree
add_index "transfers", ["post_id"], name: "index_transfers_on_post_id", using: :btree

create_table "user_joined_post", force: :cascade do |t|
t.integer "user_id"
t.integer "post_id"
end

create_table "users", force: :cascade do |t|
t.string "username", null: false
t.string "email", null: false
Expand Down
9 changes: 0 additions & 9 deletions spec/fabricators/post_fabricator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@
user { Fabricate(:user) }
description { Faker::Lorem.paragraph }
category { Fabricate(:category) }
permanent { false }
joinable { false }
global { false }
active { true }

end
Expand All @@ -19,9 +16,6 @@
user { Fabricate(:user) }
description { Faker::Lorem.paragraph }
category { Fabricate(:category) }
permanent { false }
joinable { false }
global { false }
active { true }

end
Expand All @@ -34,9 +28,6 @@
user { Fabricate(:user) }
description { Faker::Lorem.paragraph }
category { Fabricate(:category) }
permanent { false }
joinable { false }
global { false }
active { true }

end