Oct 15

You may find yourself needing to test something with a specific version of thin, for whatever reason. If you need start up thin with a specific version of gem you have installed this is how you do it:

<pre>thin _1.2.4_ -R config.ru -p 3001 start</pre>

The first argument represents the gem version prefixed and post-fixed with “_”.

Enjoy.

Tagged with:
Aug 10

When working with Sinatra + ActiveRecord + MySQL running on the venerable Thin server, you are probably going to see the error after 8 hours(MySQL default connection timeout): “Mysql::Error: MySQL server has gone away” message. The resolution is pretty simple:

class NewApp < Sinatra::Default   

  before do
    ActiveRecord::Base.connection.verify!
  end
...
end #end of Sinatra class

I created a Lighthouse ticket before I discovered the resolution. There are also more technical details here: https://thin.lighthouseapp.com/projects/7212-thin/tickets/101-activerecord-connection-does-not-reconnect-when-using-thinsinatra-but-works-fine-with-just-sinatra#ticket-101-4

Tagged with: