librelist archives

« back to archive

A note for theme authors

A note for theme authors

From:
Graham Ashton
Date:
2010-12-04 @ 15:15
Aaron's problem last week was partly due to the way Nesta behaves if you 
define a catch all route in your theme. Something like this:

  get "*" do
    # do stuff
  end

The theme's routes get loaded before the default routes, and once Sinatra 
finds a catch all route none of the routes defined beneath it will get a 
chance to run. This means that a "*" route in a theme prevents all other 
routes from working; you have to copy all the routes into the theme's 
app.rb file.

That behaviour wasn't very clear, and it seemed like a bug (to both of us).

Having said that, I think copying all the routes into a theme is the way 
forward; it removes the possibility that a theme could be broken by future
changes to Nesta's default routes.

I just added a note to the docs to that effect:

http://effectif.com/nesta/creating-themes#defining_routes

G.