lib/active_admin/menu.rb in activeadmin-0.6.6 vs lib/active_admin/menu.rb in activeadmin-1.0.0.pre1
- old
+ new
@@ -45,13 +45,13 @@
# menu.add label: 'Dashboard'
# menu.add parent: 'Dashboard', label: 'My Child Dashboard'
#
def add(options)
item = if parent = options.delete(:parent)
- (self[parent] || add(:label => parent)).add options
+ (self[parent] || add(label: parent)).add options
else
- _add options.merge :parent => self
+ _add options.merge parent: self
end
yield(item) if block_given?
item
@@ -89,11 +89,13 @@
self[item.id] = item
end
def normalize_id(id)
case id
- when String, Symbol
- id.to_s.downcase.gsub ' ', '_'
+ when String, Symbol, ActiveModel::Name
+ id.to_s.downcase.tr ' ', '_'
+ when ActiveAdmin::Resource::Name
+ id.param_key
else
raise TypeError, "#{id.class} isn't supported as a Menu ID"
end
end
end