layer|twenty|two

by Piotr Usewicz

10 Jan

New rails_sequel Plugin

Recently, I was porting an Merb and Rails application from DataMapper to Sequel. It is pretty much straightforward with Merb, as you only have to specify use_orm :sequel in your init.rb file to get Sequel configured automatically.

With Rails you have to do this manually eg.:

DB = Sequel.connect('mysql://localhost/database')

or... use my new plugin rails_sequel.

rails_sequel is a simple plugin which loads Sequel, reads database.yml file and adds missing methods such as to_param or new_record?.

You can install it like any other Rails plugin:

script/plugin install git://github.com/pusewicz/rails_sequel.git

Alternatively you can install a gem:

# Initializer for the class.
def initialize( string )
  @str = string
end

Load the gem in environment.rb

Rails::Initializer.run do |config|
  config.gem 'pusewicz-rails_sequel', :version => '~> 0.0.2', :lib => 'rails_sequel', :source => 'http://gems.github.com'
end

You might want to remove ActiveRecord framework in environment.rb file as well:

config.frameworks -= [ :active_record ]
01 Jan

Happy New Year!

Welcome to year 2009! I would like to wish a Happy New Year to all of you.

2008 was a very interesting year for me. Many exciting things happened both in my private and professional life. I have met a wonderful woman - Melissa, to whom I dedicate this very first initial entry of my blog. Thank you for being such an amazing person.

I have learned a lot of new technologies, improved my programming skills. The new job I started in January 2008 has made me a better programmer. Thanks to everybody at MIG!

I hope that this New Year will bring even more exciting stories and will help all of us become better persons.

Christmas Tree

Projects

Elsewhere

Badges

Piotr Usewicz © 2009 · Hosted by Media Temple