Skip to content

Instantly share code, notes, and snippets.

@msassak
Created September 9, 2009 17:37
Show Gist options
  • Save msassak/183915 to your computer and use it in GitHub Desktop.
Save msassak/183915 to your computer and use it in GitHub Desktop.
# config.ru
require 'appengine-rack'
AppEngine::Rack.configure_app(
:application => 'testapp',
:version => 2)
require 'testapp.rb'
run Sinatra::Application
# testapp.rb
require 'rubygems'
require 'sinatra'
require 'dm-core'
DataMapper.setup(:default, "appengine://auto")
class TestPersist
include DataMapper::Resource
property :id, Serial
property :message, Text
end
get '/' do
@t = TestPersist.all
erb :index
end
post '/seed' do
TestPersist.create(:message => params[:message])
redirect '/'
end
# views/index.erb
<form method="post" action="/seed">
<textarea name="message"></textarea>
<input type="submit" value="Go">
</form>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment