Skip to content

Instantly share code, notes, and snippets.

@marc-an-be
Created August 8, 2012 14:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save marc-an-be/3295318 to your computer and use it in GitHub Desktop.
Save marc-an-be/3295318 to your computer and use it in GitHub Desktop.
Sinatra jQuery Mobile App Chunk 4
get '/' do
@events = Event.all(:order => :time.desc)
haml :index
end
get '/new/?' do
haml :new
end
post '/new/?' do
begin
Event.create(
:time => Time.parse(params['time']),
:type => params['type'],
:description => params['description']
)
redirect '/'
rescue
haml :new
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment