Add moderated_fields_for method
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…
Reference in New Issue