Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

33 lines (25 sloc) 0.529 kb
require 'dm-core'
require 'dm-timestamps'
require 'dm-constraints'
require 'dm-migrations'
require 'haml'
require File.join(File.dirname(__FILE__), 'lib/post')
class DataMapperExample < Sinatra::Base
get '/' do
redirect '/posts'
end
get '/post/new' do
haml :new_post
end
get '/posts' do
@posts = Post.all
haml :posts
end
post '/post/add' do
post = Post.create(title: params[:title], body: params[:body])
redirect "/posts"
end
get '/application.css' do
sass :style
end
end
Jump to Line
Something went wrong with that request. Please try again.