class DbBrowser::Server

Constants

PUBLIC_FOLDER
VIEWS_FOLDER

Public Class Methods

banner() click to toggle source

Public Instance Methods

db_path( key ) click to toggle source
# File lib/dbbrowser/server.rb, line 40
def db_path( key )
  "#{path_prefix}/db/#{key}"
end
h( text ) click to toggle source
# File lib/dbbrowser/server.rb, line 52
def h( text )
  Rack::Utils.escape_html(text)
end
path_prefix() click to toggle source
# File lib/dbbrowser/server.rb, line 36
def path_prefix
  request.script_name   # request.env['SCRIPT_NAME']
end
render_spec_for( key, opts={} ) click to toggle source
# File lib/dbbrowser/server.rb, line 56
def render_spec_for( key, opts={} )
  # render connection spec(ification) aka configuration
  spec = ActiveRecord::Base.configurations[ key ]
  erb( 'shared/_spec'.to_sym,
       layout: false,
       locals: { spec: spec })
end
render_table_def( table, opts={} ) click to toggle source
# File lib/dbbrowser/server.rb, line 64
def render_table_def( table, opts={} )
  erb( 'shared/_table_def'.to_sym,
       layout: false,
       locals: { table: table } )
end
render_tables( tables, opts={} ) click to toggle source
# File lib/dbbrowser/server.rb, line 70
def render_tables( tables, opts={} )
  erb( 'shared/_tables'.to_sym,
       layout: false,
       locals: { tables: tables } )
end
render_tables_for( key, opts={} ) click to toggle source
# File lib/dbbrowser/server.rb, line 76
def render_tables_for( key, opts={} )
  con = settings.browser.connection_for( key )
  erb( 'shared/_tables'.to_sym,
       layout: false,
       locals: { tables: con.tables } )
end
root_path() click to toggle source
# File lib/dbbrowser/server.rb, line 48
def root_path
  "#{path_prefix}/"
end
table_path( table ) click to toggle source
# File lib/dbbrowser/server.rb, line 44
def table_path( table )
  "#{path_prefix}/db/#{table.connection.key}/#{table.name.downcase}"
end