私のコードは次のとおりです。
require 'bundler/setup'
require 'sinatra/base'
require 'jdbc/postgres'
require 'sequel'
require 'logger'
require 'json'
require 'sinatra/reloader'
class DemoApiApp < Sinatra::Application
#set :show_exceptions, false
configure :development do
register Sinatra::Reloader
end
#connect to the database
DB ||= Sequel.connect(ENV['data_source'])
#DB2 ||= Sequel.connect(ENV['data_source_2'])
#Sequel::Model.db = DB2
#DB.loggers << $logger if $logger
#DB.log_warn_duration = 2 #0.2
#DB.sql_log_level = :debug
set :views, 'views/demo_api/'
get'/api_docs' do
@nav_title = "API Documentation"
@title = "API Documentation"
@css ="dental"
@dir ="api_docs"
erb :demo_api_layout
end
get'/?' do
@nav_title = "Plan A Member Portal - Medical"
@title = "Medical Cost Estimator"
@css = "medical"
@dir = "medical/demo_api_index"
@main_color = "2E57A1"
@secondary_color = "353EA8"
@txt_color = "0F2F69"
@focus_color = "7E9BD0"
@deductible = 5000
@zip = 12211
@proc = 33010
@in_charge = 50
@in_reimburse = 0
@common_conditions = [{"key"=>"workbook", "description"=>"Cost Profile", "procs"=>[ ["33010"], ["93000"], ["80061"] ]}]
erb :demo_api_layout
end
end
# Dir.glob(File.expand_path(File.dirname(__FILE__)) + '/{helpers,controllers,models}/*.rb'). each { | file | require file }
require 'demo_api_controller'
# require 'models'
end
サイトにアクセスすると、空白のページが表示されます。何か助けはありますか?
編集 1: demo_api_layout.erb の内容
<!DOCTYPE html>
<!-- paulirish.com/2008/conditional-stylesheets-vs-css-hacks-answer-neither/ -->
<!--[if lt IE 7 ]> <html class="ie6" lang="en"> <![endif]-->
<!--[if IE 7 ]> <html class="ie7" lang="en"> <![endif]-->
<!--[if IE 8 ]> <html class="ie8" lang="en"> <![endif]-->
<!--[if (gte IE 9)|!(IE)]><!--> <html lang="en"> <!--<![endif]-->
<head>
<meta charset="utf-8" />
<!-- Uncomment to make IE8 render like IE7 -->
<!-- <meta http-equiv="X-UA-Compatible" content="IE=7" /> -->
<!-- Set the viewport width to device width for mobile -->
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title><%= @title %></title>
<!-- Included CSS Files -->
<link href="/css/stylesheets/foundation.css" rel="stylesheet" type="text/css" />
<link href="/css/stylesheets/foundation_icons_general/stylesheets/general_foundicons.css" rel="stylesheet" type="text/css" />
<!-- foundation css override file -->
<link href="/css/stylesheets/overrides/foundation_and_overrides_<%= @css %>.css" rel="stylesheet" type="text/css" />
<!-- Included JS Files -->
<script type="text/javascript" src="/js/javascripts/foundation.min.js"></script>
<script type="text/javascript" src="/js/javascripts/jquery.js"></script>
</head>
<body>
<%= erb :navbar %>
<%= erb :"#{@dir}" %>
<%= erb :footer %>
</body>
</html>