Where do you put your Rack middleware files and requires?

As of Rails 3.2, Rack middleware belongs in the app/middleware directory. It works “out-of-the-box” without any explicit require statements. Quick example: I’m using a middleware class called CanonicalHost which is implemented in app/middleware/canonical_host.rb. I’ve added the following line to production.rb (note that the middleware class is explicitly given, rather than as a quoted string, which … Read more

Logging in Sinatra?

Sinatra 1.3 will ship with such a logger object, exactly usable as above. You can use edge Sinatra as described in “The Bleeding Edge”. Won’t be that long until we’ll release 1.3, I guess. To use it with Sinatra 1.2, do something like this: require ‘sinatra’ use Rack::Logger helpers do def logger request.logger end end

Foreman: Use different Procfile in development and production

You could use two Procfiles (e.g. Procfile and Procfile.dev) and use foremans -f option to select a different one to use in dev: In dev (Procfile.dev contains your shotgun web process): foreman start -f Procfile.dev In production, foreman start will pick up the normal Procfile. Alternatively you could create a bin directory in your app … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)