forked from ashleygwilliams/student-sinatra
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathapp.rb
executable file
·56 lines (43 loc) · 1.14 KB
/
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
require 'sinatra/base'
require 'sqlite3'
require_relative 'lib/concerns/persistable'
require_relative 'lib/concerns/findable'
require_relative 'lib/models/student'
# Why is it a good idea to wrap our App class in a module?
module StudentSite
class App < Sinatra::Base
# def initialize
# super
# @artists = ["Frank Sinatra", "Bing Crosby", "Bob\n\n\n\n", 1, 2, "dslajkffoiejfijasdlfl"]
# end
# def set_random_numbers(arg)
# @random_numbers = arg
# end
get '/' do
@students = Student.all
erb :'students/students'
end
# get '/hello-world' do
# set_random_numbers((1..20).to_a)
# p @random_numbers
# erb :hello
# end
# get '/artists' do
# erb :artists
# end
get '/students' do
@students = Student.all
erb :'students/students'
end
get '/students/:url' do
# @students = Student.all
@student = Student.find_by_url(params[:url])
erb :'students/student_profile'
end
get '/id/:id' do
# @students = Student.all
@student = Student.find(params[:id])
erb :'students/student_profile'
end
end
end