
I’m really happy to announce that my latest PeepCode screencast, Meet Sinatra has just been released. This screencast was a lot of fun to develop, and like all of the PeepCodes I’ve been a part of creating, it represents a great collaborative effort between myself and Geoffrey. I’d also like to thank my friends who helped out with their great ideas and suggestions.
I love building applications in Ruby, and I think the Rails framework is amazing, but sometimes I just want to write quick web apps with less code. The Sinatra framework is perfect for just these kinds of applications, and this screencast will help you get started, from basic topics like handlers and templates to more advanced techniques, like using DataMapper and Sqlite3, while you build a working ad server.






Ola
13 October 2009 at 8:22 pm
The Screencast was a really good introduction to Sinatra and I will definitely use it when the right project comes along.
Just one question:
Why did you handle the delete action with a GET request? Wouldn’t it be better to GET a confirm_destruction action and send a DELETE request, even if the action was protected?
I would also be nice to see how to use a library to rescale the images after upload.
Thanks for a great screencast.
Teddy
14 October 2009 at 5:07 am
@Ola: dm-paperclip (http://github.com/krobertson/dm-paperclip/) is a port of the paperclip gem to work with DataMapper. (A screenfast for that wouldn’t be longer than a few minutes.)
@Dan: Loved the screencast (and your previous ones - they finally got me to organize and version control my configuration files, and more). Out of curiosity though, are you planning on a screencast about testing? That’d pretty much complete the circle for me (command line, sinatra and then testing). Thanks for your awesome work.
Ola
14 October 2009 at 7:15 am
@Teddy: Thanks for the link I’ll check it out.
Ian B
14 October 2009 at 9:50 am
Wow. Perfect timing! I’ve just started putting together a Sinatra app and an overview screencast is what I’ve been looking for. The Mercurial cast was excellent too.
Diana Dare
23 November 2009 at 4:12 pm
Ruby - the best!
Alexandre Rousseau
24 November 2009 at 8:38 am
@Dan, thanks for the screencast. Very interesting, but may be broken. Followed your instructions to the letter yet, am unable to delete records.
Error reports:
NoMethodError at /delete/1
private method `delete’ called for #<Ad:0x17a13a8>
Suspecting some compatibility problem with DataMapper, I replaced this:
# in adserver.rb
# get ‘/delete/:id’ do
...
ad.delete unless ad.nil?
...
end
with this:
get ‘/delete/:id’ do
...
ad.destroy unless ad.nil?
...
end
And delete now works… I spent an hour on this problem and hope you can update the peepcast to help others avoid a similar fate.
Other than that (halfway through the peepcast now), it’s been great.
Thanks
Alex
Alexandre Rousseau
24 November 2009 at 10:24 am
Also, I spotted a discrepancy between ad.erb line 5 at 40:06:10:
advert += ‘<a href=“http://%= env[”>/click/<%= @ad.id %>”>’;
...and at 45:03:09:
advert += ‘<a >”>’;
On a sidenote, it would be useful to have version info on this peepcast. That’ll help avoid misunderstandings.
A.
Alexandre Rousseau
24 November 2009 at 10:26 am
Whoops. I see that my pasted code got garbled.
Anyway, look for the discrepancy at line 5, in ad.erb, at 40:06:10 and at 45:03:09.
Cheers
A.
Ben
06 December 2009 at 9:00 pm
A hearty second to Alexandre. I think the change from delete to destroy came in datamapper .10 (newer than the screencast version), but it would be nice to have updated release notes.
Otherwise, excellent tutorial. Love my PeepCode unlimited subscription.
Phil Peterman
17 December 2009 at 4:07 pm
I heartily concur, spent about 15 minutes over at peepcode.com looking for an errata section before going to the search engines and finding this posting.
A simple errata page at peepcode.com would be a very useful thing.