Skip to content

Instantly share code, notes, and snippets.

@esad
Created June 8, 2011 18:59
Show Gist options
  • Save esad/1015087 to your computer and use it in GitHub Desktop.
Save esad/1015087 to your computer and use it in GitHub Desktop.
Prefix routes in sinatra
# Prefix routes with /api/v1
%w(get post head options put).each do |method|
eval <<-RUBY
def self.#{method}(path, opts={}, &bk)
super("/api/v1"+path,opts,&bk)
end
RUBY
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment