mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-12-18 03:25:31 -05:00
0d01c33482
All models are now using ActiveModel::ForbiddenAttributesProtection, which shifts the responsibility for parameter whitelisting for mass-assignments from the model to the controller. attr_accessible has been disabled and removed as this functionality replaces that. The require_parameters method in the ApplicationController has been removed in favor of strong_parameters' #require method. It is important to note that there is still some refactoring required to get all parameters to pass through #require and #permit so that we can guarantee that parameter values are scalar. Currently strong_parameters, in most cases, is only being utilized to require parameters and to whitelist the few places that do mass-assignments.
28 lines
819 B
Ruby
28 lines
819 B
Ruby
# AdminLog stores information about actions that admins and moderators have taken,
|
|
# like deleting users, changing site settings, etc.
|
|
# Use the AdminLogger class to log records to this table.
|
|
class AdminLog < ActiveRecord::Base
|
|
belongs_to :admin, class_name: 'User'
|
|
belongs_to :target_user, class_name: 'User' # can be nil
|
|
|
|
validates_presence_of :admin_id
|
|
validates_presence_of :action
|
|
|
|
def self.actions
|
|
@actions ||= Enum.new(:delete_user)
|
|
end
|
|
end
|
|
|
|
# == Schema Information
|
|
#
|
|
# Table name: admin_logs
|
|
#
|
|
# id :integer not null, primary key
|
|
# action :integer not null
|
|
# admin_id :integer not null
|
|
# target_user_id :integer
|
|
# details :text
|
|
# created_at :datetime not null
|
|
# updated_at :datetime not null
|
|
#
|
|
|