Skip to content
Find file
Fetching contributors…
Cannot retrieve contributors at this time
26 lines (16 sloc) 414 Bytes

Synopsis

Granular before filters for Sinatra

Install

gem install sinatra-any

Use

require 'sinatra'
require 'sinatra/any'

any "/api/v2/*" do
  halt 403 if unauthorized?
end

get "/api/v2/widgets" do
  do_somthing_for_authorized_users
end

Thanks

@jbarnette (John Barnette) for convicing me this is a real problem
to solve because Rails can't follow specs.
Jump to Line
Something went wrong with that request. Please try again.