Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
30 lines (24 sloc) 646 Bytes
require File.dirname(__FILE__) + '/lib/common.rb'
require 'rack/cache'
class MountedApp < Sinatra::Base
set :app_file, __FILE__
set :logging, true
use Rack::Cache do
set :verbose, true
set :metastore, 'heap:/'
set :entitystore, 'heap:/'
end
get '/' do
redirect '/posts'
end
mount(Post) do
finder { |model, params| model.all }
record { |model, params| model.first(:id => params[:id]) }
# Mount children as a nested resource
mount(Comment) do
finder { |model, params| model.all }
record { |model, params| model.first(:id => params[:id]) }
end
end
end
MountedApp.run!