Sinatra Routing Exceptions

Posted by Ethan Turkeltaub on Stack Overflow See other posts from Stack Overflow or by Ethan Turkeltaub
Published on 2010-03-14T22:32:03Z Indexed on 2010/03/14 22:35 UTC
Read the original article Hit count: 190

Filed under:
|

I want to be able to do the following:

get '/:slug' do
  haml :page
end

get '/administration' do
  haml :admin
end

Is there a way that I can have get '/:slug' do have an exception for /administration? I realize you can do this with if else statements:

get '/:slug' do
  if params[:slug] == 'administration'
    haml :admin
  else
    haml :page
  end
end

But that isn't very clean looking. Is there a way to have an exception to routes?

© Stack Overflow or respective owner

Related posts about sinatra

Related posts about routing