class SinatraAdmin::Config

Constants

ATTRIBUTES

Public Instance Methods

admin_model() click to toggle source
# File lib/sinatra-admin/config.rb, line 21
def admin_model
  @admin_model ||= SinatraAdmin::Admin
end
default_route() click to toggle source
# File lib/sinatra-admin/config.rb, line 9
def default_route
  @default_route ||=
    if root
      route = root.underscore.pluralize
      raise RegistrationException, "The resource #{root} was not registered" unless routes.include?(route)
      "/admin/#{route}"
    else
      raise RegistrationException, 'You should register at least one resource' if routes.empty?
      "/admin/#{routes.first}"
    end
end
reset!() click to toggle source
USE THIS METHOD CAREFULLY! ###########

Sets ALL config to nil and remove ALL registered routes. It means that this method is going to remove the WHOLE SinatraAdmin functionality

# File lib/sinatra-admin/config.rb, line 40
def reset!
  ATTRIBUTES.each {|attr| send("#{attr.to_s}=", nil)}
  routes.clear
end
routes() click to toggle source

Store all registered routes. Executing:

SinatraAdmin.register('User')
SinatraAdmin.register('Tags')

The result is going to be:

@routes => ['users', 'tags']
# File lib/sinatra-admin/config.rb, line 32
def routes
  @routes ||= []
end