-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.rb
26 lines (22 loc) · 812 Bytes
/
app.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
class App < Sinatra::Base
set :views, settings.root + '/app/views'
get '/' do
@title = ApplicationController::DEFAULT_TITLE
haml 'home'.to_sym
end
get '/:type' do
variables = Object.const_get("#{params[:type].capitalize}Controller").new(params).call
variables.map(&method(:instance_variable_set))
haml "#{params['type']}/index".to_sym
end
get '/:type/:brand' do
variables = Object.const_get("#{params[:type].capitalize}Controller").new(params).call
variables.map(&method(:instance_variable_set))
haml "#{params['type']}/show".to_sym
end
get '/:type/:brand/:model' do
variables = Object.const_get("#{params[:type].capitalize}Controller").new(params).call
variables.map(&method(:instance_variable_set))
haml "#{params['type']}/show".to_sym
end
end