Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 33 lines (25 sloc) 0.529 kB
7bebaf4 configuring cucumber & rspec
Despo authored
1 require 'dm-core'
2 require 'dm-timestamps'
3 require 'dm-constraints'
4 require 'dm-migrations'
5 require 'haml'
6
7 require File.join(File.dirname(__FILE__), 'lib/post')
8
0b9401d initial commit
Despo authored
9 class DataMapperExample < Sinatra::Base
10
2b90e6d added a message for users accessing root
Despo authored
11 get '/' do
b195a8d @despo using
authored
12 redirect '/posts'
2b90e6d added a message for users accessing root
Despo authored
13 end
14
bf75844 the new post page can now be accessed
Despo authored
15 get '/post/new' do
bf33ad8 adding & displaying a post
Despo authored
16 haml :new_post
17 end
18
19 get '/posts' do
20 @posts = Post.all
21 haml :posts
22 end
bf75844 the new post page can now be accessed
Despo authored
23
bf33ad8 adding & displaying a post
Despo authored
24 post '/post/add' do
1468530 @despo shorten
authored
25 post = Post.create(title: params[:title], body: params[:body])
bf33ad8 adding & displaying a post
Despo authored
26 redirect "/posts"
bf75844 the new post page can now be accessed
Despo authored
27 end
0b9401d initial commit
Despo authored
28
a946805 @despo it should look like this...
authored
29 get '/application.css' do
30 sass :style
31 end
0b9401d initial commit
Despo authored
32 end
Something went wrong with that request. Please try again.