mirror of
https://github.com/wahyd4/libr-2.git
synced 2026-08-09 05:15:53 +10:00
#31 add soft delete
This commit is contained in:
+1
-1
@@ -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
@@ -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
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user