adds paranoia to User
This commit is contained in:
committed by
Juanjo Bazán
parent
2b6ea3a40f
commit
bd16e9345a
@@ -1,9 +1,11 @@
|
|||||||
class User < ActiveRecord::Base
|
class User < ActiveRecord::Base
|
||||||
|
include ActsAsParanoidAliases
|
||||||
apply_simple_captcha
|
apply_simple_captcha
|
||||||
devise :database_authenticatable, :registerable, :confirmable,
|
devise :database_authenticatable, :registerable, :confirmable,
|
||||||
:recoverable, :rememberable, :trackable, :validatable
|
:recoverable, :rememberable, :trackable, :validatable
|
||||||
|
|
||||||
acts_as_voter
|
acts_as_voter
|
||||||
|
acts_as_paranoid column: :hidden_at
|
||||||
|
|
||||||
has_one :administrator
|
has_one :administrator
|
||||||
has_one :moderator
|
has_one :moderator
|
||||||
|
|||||||
6
db/migrate/20150819135933_add_hidden_at_to_users.rb
Normal file
6
db/migrate/20150819135933_add_hidden_at_to_users.rb
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
class AddHiddenAtToUsers < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
add_column :users, :hidden_at, :datetime
|
||||||
|
add_index :users, :hidden_at
|
||||||
|
end
|
||||||
|
end
|
||||||
14
db/schema.rb
14
db/schema.rb
@@ -11,7 +11,7 @@
|
|||||||
#
|
#
|
||||||
# It's strongly recommended that you check this file into your version control system.
|
# It's strongly recommended that you check this file into your version control system.
|
||||||
|
|
||||||
ActiveRecord::Schema.define(version: 20150817150457) do
|
ActiveRecord::Schema.define(version: 20150819135933) do
|
||||||
|
|
||||||
# These are extensions that must be enabled in order to support this database
|
# These are extensions that must be enabled in order to support this database
|
||||||
enable_extension "plpgsql"
|
enable_extension "plpgsql"
|
||||||
@@ -137,16 +137,18 @@ ActiveRecord::Schema.define(version: 20150817150457) do
|
|||||||
t.datetime "confirmation_sent_at"
|
t.datetime "confirmation_sent_at"
|
||||||
t.string "unconfirmed_email"
|
t.string "unconfirmed_email"
|
||||||
t.string "nickname"
|
t.string "nickname"
|
||||||
t.string "phone_number", limit: 30
|
t.boolean "use_nickname", default: false, null: false
|
||||||
t.boolean "use_nickname", default: false, null: false
|
t.boolean "email_on_debate_comment", default: false
|
||||||
t.boolean "email_on_debate_comment", default: false
|
t.boolean "email_on_comment_reply", default: false
|
||||||
t.boolean "email_on_comment_reply", default: false
|
|
||||||
t.string "official_position"
|
t.string "official_position"
|
||||||
t.integer "official_level", default: 0
|
t.integer "official_level", default: 0
|
||||||
|
t.string "phone_number", limit: 30
|
||||||
|
t.datetime "hidden_at"
|
||||||
end
|
end
|
||||||
|
|
||||||
add_index "users", ["confirmation_token"], name: "index_users_on_confirmation_token", unique: true, using: :btree
|
add_index "users", ["confirmation_token"], name: "index_users_on_confirmation_token", unique: true, using: :btree
|
||||||
add_index "users", ["email"], name: "index_users_on_email", unique: true, using: :btree
|
add_index "users", ["email"], name: "index_users_on_email", unique: true, using: :btree
|
||||||
|
add_index "users", ["hidden_at"], name: "index_users_on_hidden_at", using: :btree
|
||||||
add_index "users", ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true, using: :btree
|
add_index "users", ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true, using: :btree
|
||||||
|
|
||||||
create_table "visits", id: :uuid, default: nil, force: :cascade do |t|
|
create_table "visits", id: :uuid, default: nil, force: :cascade do |t|
|
||||||
|
|||||||
Reference in New Issue
Block a user