Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Proper error handling for Page#allowed_child_classes
  • Loading branch information
blj committed Feb 10, 2012
1 parent df0c981 commit b81c0cd
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion app/models/menu_renderer.rb
Expand Up @@ -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
Expand Down

0 comments on commit b81c0cd

Please sign in to comment.