我正在运行<select name="id_kategori" id="id_kategori" class="form-control">
<option selected>kategori</option>
<?php foreach($kategori as $item){ <--edit
echo '<option value='.$item['id_kategori'].'>'.$item['kategori'].'</option>';
}?>
</select>
。
config.ru文件包含:
rackup config.ru
哪个返回:
require 'sinatra'
require 'sinatra/base'
app = ->(env){
status = 200
headers = {"content-type" => "text/html"}
body = ["<Html><Body><H1>Hello, World!</H1></Body></Html>"]
[status, headers, body]
}
run app
我的Exception `LoadError' at /Users/konstantinosschoinas/.rvm/gems/ruby-2.6.3/gems/sinatra-base-1.0/lib/sinatra/showexceptions.rb:1 - cannot load such file -- rack/showexceptions
Exception `LoadError' at /Users/konstantinosschoinas/.rvm/gems/ruby-2.6.3/gems/sinatra-base-1.0/lib/sinatra/base.rb:6 - cannot load such file -- rack/showexceptions
Exception `LoadError' at /Users/konstantinosschoinas/.rvm/gems/ruby-2.6.3/gems/sinatra-base-1.0/lib/sinatra.rb:4 - cannot load such file -- rack/showexceptions
Exception `LoadError' at /Users/konstantinosschoinas/Desktop/projects/bookstore-api/config.ru:1 - cannot load such file -- rack/showexceptions
Exception `LoadError' at /Users/konstantinosschoinas/.rvm/gems/ruby-2.6.3/bin/rackup:23 - cannot load such file -- rack/showexceptions
输出是:
gem env
我用gem安装了Sinatra和Sinatra :: Base。
我在做什么错了?
答案 0 :(得分:1)
您需要将Sinatra gem更新为sinatra-2.0.7
。
运行:
$ gem install sinatra -v 2.0.7