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.
10 lines
164 B
Ruby
10 lines
164 B
Ruby
class IpAddressPolicy < ApplicationPolicy
|
|
def index?
|
|
user.is_moderator?
|
|
end
|
|
|
|
def html_data_attributes
|
|
super & attributes.keys.map(&:to_sym)
|
|
end
|
|
end
|