#31 add soft delete

This commit is contained in:
2015-11-25 23:12:18 +08:00
parent 35cfd7b922
commit b41b2b80fa
4 changed files with 9 additions and 3 deletions
+1 -1
View File
@@ -3,7 +3,7 @@ ActiveAdmin.register Post do
# See permitted parameters documentation:
# https://github.com/activeadmin/activeadmin/blob/master/docs/2-resource-customization.md#setting-up-strong-parameters
#
# permit_params :list, :of, :attributes, :on, :model
permit_params :blocked, :processed, :good_format
#
# or
#
+1 -1
View File
@@ -12,7 +12,7 @@ class Post < ActiveRecord::Base
acts_as_paranoid
# default_scope { order(:created_at => :desc) }
# default_scope {where(:blocked => false)}
def first_sharer
share_instances.first.user_name
@@ -0,0 +1,5 @@
class AddBlockedToPost < ActiveRecord::Migration
def change
add_column :posts, :blocked, :boolean, default: false
end
end
+2 -1
View File
@@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20151123161926) do
ActiveRecord::Schema.define(version: 20151125145909) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
@@ -145,6 +145,7 @@ ActiveRecord::Schema.define(version: 20151123161926) do
t.string "summary"
t.integer "bookmarks_count", default: 0
t.datetime "deleted_at"
t.boolean "blocked", default: false
end
add_index "posts", ["deleted_at"], name: "index_posts_on_deleted_at", using: :btree