Add moderated_fields_for method
This commit is contained in:
parent
9c24f2fc1b
commit
1752c5a843
@ -23,6 +23,11 @@ module TheModerator
|
||||
false
|
||||
end
|
||||
|
||||
def moderated_fields_for(assoc)
|
||||
moderations.map { |m| m.moderated_fields_for(assoc) }
|
||||
.inject(&:|)
|
||||
end
|
||||
|
||||
protected
|
||||
|
||||
def moderation_data(*moderated_attributes)
|
||||
|
@ -41,6 +41,10 @@ module TheModerator
|
||||
include_attribute?(attribute, data[:attributes])
|
||||
end
|
||||
|
||||
def moderated_fields_for(assoc)
|
||||
(data[:attributes][assoc].try(:keys) || []) - [:id]
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def include_attribute?(attribute, attr_data)
|
||||
|
Loading…
x
Reference in New Issue
Block a user