Newbie to Sinatra looking for example

3 views
Skip to first unread message

ThinkWriteMute

unread,
Oct 30, 2009, 7:40:39 PM10/30/09
to sinatrarb
Alright, so I'm pretty new to both Sinatra and web applications, and I
was wondering if someone could write up a quick example use of
Sinatra. Basically I want to see how Sinatra handles <form>s in one
view, and then shows the input on a different view.

I hope that doesn't sound too confusing.

Matthew Winter

unread,
Oct 30, 2009, 8:10:27 PM10/30/09
to sina...@googlegroups.com
Hi,

PeepCode has a good Sinatra introduction screencast. If you want
actual code examples then there are a number of good example
applications on GitHub most of which have links from the main Sinatra
website.

Regards
Matthew Winter

On 31/10/2009, at 10:40 AM, ThinkWriteMute <thinkwr...@gmail.com>
wrote:

Ryan Tomayko

unread,
Oct 30, 2009, 8:16:48 PM10/30/09
to sina...@googlegroups.com
require 'sinatra'

get '/' do
erb "<form method=POST><input name=mess></form>"
end

post "/" do
erb "Hot <%= escape_html(params[:mess]) %>"
end

__END__
@@ layout
<!DOCTYPE html>
<html><%= yield %></html>

# tomayko.com/about

Sam Warmuth

unread,
Oct 30, 2009, 8:16:13 PM10/30/09
to sina...@googlegroups.com
I'm new to Sinatra myself, but I recently built a little database app
for one of my classes. I'm not sure if it's what you're looking for,
but it has basic form functionality.

The code's on github : http://github.com/harpastum/movieDB

If you want to check out a running instance (heroku) with some basic
data, it's here: http://moviedb.samwarmuth.com/
--

Sam

ThinkWriteMute

unread,
Oct 30, 2009, 8:44:41 PM10/30/09
to sinatrarb
Ah, I didn't know there were examples on the github that were that
specific!

On Oct 30, 7:10 pm, Matthew Winter <winte...@teratools.com> wrote:
> Hi,
>
> PeepCode has a good Sinatra introduction screencast. If you want  
> actual code examples then there are a number of good example  
> applications on GitHub most of which have links from the main Sinatra  
> website.
>
> Regards
> Matthew Winter
>
> On 31/10/2009, at 10:40 AM, ThinkWriteMute <thinkwritem...@gmail.com>  

ThinkWriteMute

unread,
Oct 30, 2009, 9:06:31 PM10/30/09
to sinatrarb
Thank you thank you! This makes sense :D

On Oct 30, 7:16 pm, Ryan Tomayko <r...@tomayko.com> wrote:
> require 'sinatra'
>
> get '/' do
>   erb "<form method=POST><input name=mess></form>"
> end
>
> post "/" do
>   erb "Hot <%= escape_html(params[:mess]) %>"
> end
>
> __END__
> @@ layout
> <!DOCTYPE html>
> <html><%= yield %></html>
>
> # tomayko.com/about
>
> On Fri, Oct 30, 2009 at 4:40 PM, ThinkWriteMute
>
Reply all
Reply to author
Forward
0 new messages