-
-
Save travisdmathis/4e573f0e0c920867f099 to your computer and use it in GitHub Desktop.
refactor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def is_catalog_unique?(catalogs, user, folder_name) | |
if catalogs.blank? | |
@catalog = user.root_catalog | |
children = @catalog.live_children | |
children.each do |child| | |
if folder_name.gsub("+", " ") == child.name | |
return false | |
end | |
end | |
else | |
catalogs.each do |catalog_id| | |
@catalog = user.role.catalogs.find_by_id(catalog_id) | |
children = @catalog.live_children | |
children.each do |child| | |
if folder_name.gsub("+", " ") == child.name | |
return false | |
end | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment