QA@IT

プログラム部分をコードブロックにしてインデントしました

354
本文
 retrieve.erbでデータベースの内容を検索し、その結果をresult.erbに出力しようとかんがえています。ruby on railsのようにcontrollerに render :action => 'result.html.erb'のように書きたいのですが、どのようにしたらよいのでしょか。よろしくお願いします。
 以下にソースをのせておきます。非常に困っているのでよろしくお願いします。
+
+```ruby
 # coding:utf-8
 require 'active_record'
 require 'sinatra'
 end
 
 get '/retrieve' do
-erb :retrieve
+  erb :retrieve
 end
 
 post '/retrieve' do
-@bookinfos = Bookinfo.where( " title like ? OR author like ? ", "%#{params[:id]}%", "%#{params[:id]}%" )
-redirect to action 'retrieve.erb'
+  @bookinfos = Bookinfo.where( " title like ? OR author like ? ", "%#{params[:id]}%", "%#{params[:id]}%" )
+  redirect to action 'retrieve.erb'
 end
 
 get '/result' do
-erb :result
+  erb :result
 end
 
 get '/' do
-@bookinfos = Bookinfo.all
-erb :index
+  @bookinfos = Bookinfo.all
+  erb :index
 end
 
 post '/new' do
-bookinfo = Bookinfo.new
-bookinfo.id = params[:id]
-bookinfo.title = params[:title]
-bookinfo.author = params[:author]
-bookinfo.page = params[:page]
-bookinfo.date_available = params[:date_available]
-bookinfo.save
-redirect '/'
+  bookinfo = Bookinfo.new
+  bookinfo.id = params[:id]
+  bookinfo.title = params[:title]
+  bookinfo.author = params[:author]
+  bookinfo.page = params[:page]
+  bookinfo.date_available = params[:date_available]
+  bookinfo.save
+  redirect '/'
 end
 
 delete '/del' do
-bookinfo = Bookinfo.find(params[:id])
-bookinfo.destroy
-redirect '/'
+  bookinfo = Bookinfo.find(params[:id])
+  bookinfo.destroy
+  redirect '/'
 end
+```