lib/trestle.rb in trestle-0.8.6 vs lib/trestle.rb in trestle-0.8.7

- old
+ new

@@ -29,16 +29,18 @@ mattr_accessor :admins self.admins = {} def self.admin(name, options={}, &block) - admin = Admin::Builder.build(name, options, &block) - self.admins[admin.admin_name] = admin + register(Admin::Builder.create(name, options, &block)) end def self.resource(name, options={}, &block) - admin = Resource::Builder.build(name, options, &block) + register(Resource::Builder.create(name, options, &block)) + end + + def self.register(admin) self.admins[admin.admin_name] = admin end def self.lookup(admin) return admin if admin.is_a?(Class) && admin < Trestle::Admin @@ -52,10 +54,10 @@ def self.configure(&block) config.configure(&block) end def self.navigation - Navigation.new(config.menus + admins.values.map(&:menu).compact) + Navigation.build(config.menus + admins.values.map(&:menu).compact) end end require "trestle/engine" if defined?(Rails)