Refactor attribute_cleaner
for readability
This commit is contained in:
parent
b240012c4f
commit
1cbdc5326c
1 changed files with 3 additions and 1 deletions
|
@ -18,13 +18,15 @@ module Gitlab
|
||||||
|
|
||||||
def clean
|
def clean
|
||||||
@relation_hash.reject do |key, _value|
|
@relation_hash.reject do |key, _value|
|
||||||
(prohibited_key?(key) && !permitted_key?(key)) || !@relation_class.attribute_method?(key) || excluded_key?(key)
|
prohibited_key?(key) || !@relation_class.attribute_method?(key) || excluded_key?(key)
|
||||||
end.except('id')
|
end.except('id')
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def prohibited_key?(key)
|
def prohibited_key?(key)
|
||||||
|
return false if permitted_key?(key)
|
||||||
|
|
||||||
'cached_markdown_version' == key || PROHIBITED_SUFFIXES.any? {|suffix| key.end_with?(suffix)}
|
'cached_markdown_version' == key || PROHIBITED_SUFFIXES.any? {|suffix| key.end_with?(suffix)}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue