models: move html_data_attributes to policies.
Move html_data_attributes definitions from models to policies. Which attributes are permitted as data-* attributes is a view level concern and should be defined on the policy level, not the model level. Models should be agnostic about how they're used in views.
This commit is contained in:
@@ -38,14 +38,6 @@ class Ban < ApplicationRecord
|
||||
q
|
||||
end
|
||||
|
||||
module ApiMethods
|
||||
def html_data_attributes
|
||||
super + [:expired?]
|
||||
end
|
||||
end
|
||||
|
||||
include ApiMethods
|
||||
|
||||
def self.prune!
|
||||
expired.includes(:user).find_each do |ban|
|
||||
ban.user.unban! if ban.user.ban_expired?
|
||||
|
||||
Reference in New Issue
Block a user