Tag-Archiv: Sinatra

No Log to STDOUT from Sinatra / Thin in development?

Today logging broke in my environment ( Rack 1.4 & Sinatra 1.4 (GIT) & Thin 1.3.1 ). Don’t know why exactly (I refreshed all my Gems) – but somehow it got fixed by adding: use Rack::CommonLogger

Veröffentlicht in Ruby | Auch getagged , , | Kommentieren

Sinatra Streaming + nginx Proxy

Fairly easy. The important line here is: proxy_buffering off; I think this one works at least for most Rack based applications. The application itself runs on thin ( besides that, I only know Unicorn and Rainbow(s?) that have Streaming Support. Webrick won’t do that (yet)) My vhost config. upstream stream { server 127.0.0.1:4800; server 127.0.0.1:4801; [...]

Veröffentlicht in Ohne Kategorie, Ruby, Server / Deployment | Auch getagged , , | Kommentieren

Rake Tasks for non-Rails application

put in your Rakefile: Load seeds: namespace :db do task :seed => :environment do seed_file = File.join(File.dirname(__FILE__), ‘db’, ‘seeds.rb’) load(seed_file) if File.exist?(seed_file) end end run Migrations & Rollback namespace :db do desc "Migrate the database through scripts in db/migrate." task :migrate => :environment do ActiveRecord::Migration.verbose = ENV["VERBOSE"] ? ENV["VERBOSE"] == "true" : true ActiveRecord::Migrator.migrate("db/migrate/", ENV["VERSION"] [...]

Veröffentlicht in Ohne Kategorie, Ruby | Auch getagged , , | Kommentieren

Global ActiveRecord Observers

Have you ever tried to get ActiveRecord Observers working in a Sinatra environment? I spent hours crawling trough the Rails sources but eventually gave up. Plus: My goal anyway was to have some kind of global observer through all models in my application. So, easy decision – I build my one solution – as always: [...]

Veröffentlicht in Ohne Kategorie, Ruby | Auch getagged , , , , | Kommentieren

ActiveRecord – Mysql Adapter – “Column Comments”

Upfront: extending existing Modules and Classes in Ruby is awesome. for one of my recent projects I had to read the “comment” from an a MySQL table field. After a short look in ActiveRecords ConnectionAdapters for MySQL I realized the existing method uses SHOW FIELDS FROM `table` instead of the necessary SHOW FULL FIELDS FROM [...]

Veröffentlicht in Database, Ruby | Auch getagged , , , , , | Kommentieren