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:
evazion
2020-08-17 17:22:41 -05:00
parent 4b18361aaf
commit 937653e519
16 changed files with 43 additions and 47 deletions

View File

@@ -1504,10 +1504,6 @@ class Post < ApplicationRecord
save
end
def html_data_attributes
super + [:has_large?, :current_image_size]
end
def self.model_restriction(table)
super.where(table[:is_pending].eq(false)).where(table[:is_flagged].eq(false)).where(table[:is_deleted].eq(false))
end