Hey Luca. I've been meaning to write this up a for a month or two. You just need to mount Nesta as a Rack app, using Rails Metal.
Have a watch of this:
http://railscasts.com/episodes/222-rack-in-rails-3
You'll be able to refer to Nesta in your routes by referring to it as Nesta::App (I only merged the commit that allows you to do this into master a week or so ago, so make sure you're up to date with the latest code on github). In order to make that work, all you should need to do is to require Nesta's app.rb file.
I'm yet to try this with Rails 3 myself, but I've been doing it for a while with Rails 2. If you have any trouble, ping me on the mailing list ([email protected]).
For people wondering how to achieve the same thing with Rails 2.3, I've been using code that looks like this (in lib/nesta_metal.rb):
require File.join(File.dirname(__FILE__), *%w[.. vendor nesta app])
class NestaMetal
def initialize(app)
@app = app
end
def call(env)
status, headers, response = Nesta::App.call(env)
(status == 404) ? @app.call(env) : [status, headers, response]
end
end
Cheers,
Graham