Skip to content
Browse files

Merge pull request #318 from blj/allowed-children-cache-error-handling

Proper error handling for Page#allowed_child_classes
  • Loading branch information...
2 parents df0c981 + b81c0cd commit 784e60ab9ff8bc08ffa5b4f3c0175615c22092a5 @saturnflyer saturnflyer committed Feb 10, 2012
Showing with 8 additions and 1 deletion.
  1. +8 −1 app/models/menu_renderer.rb
View
9 app/models/menu_renderer.rb
@@ -35,9 +35,16 @@ def menu_renderer_modules
end
def allowed_child_classes
- (allowed_children_cache.to_s.split(',') - Array(excluded_class_names)).map{|name|name.constantize rescue nil}.compact
+ (allowed_children_cache.to_s.split(',') - Array(excluded_class_names)).map do |name|
+ begin
+ name.constantize
+ rescue LoadError, NameError => e
+ nil
+ end
+ end.compact
end
+
def default_child_item
menu_item(default_child)
end

0 comments on commit 784e60a

Please sign in to comment.
Something went wrong with that request. Please try again.