Tag Archives: sinatra

A Datamapper is remixable example

I struggled a bit this afternoon getting Datamapper’s dm-is-remixable plug-in as there aren’t too many posts out there and some are out of date. Hopefully this quick overview will spare you my pain
Many sites allow you to comment on blog posts, images, videos, status, etc. having one comments table with post_id, image_id, etc. [...]

A Sinatra before only filter

In a Sinatra application you can use the ‘before’ filter to run something before every each event.

before do
puts “I will run all the time…”
end

Here’s a module that will allow you to run code only before certain routes:

module Sinatra

module BeforeOnlyFilter
def before_only(routes, &block)
before [...]