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