pithyless pithyless - 1 year ago 64
Ruby Question

Rails 3 integrated with Sequel?

There appear to be at least four repos on github that claim to tie in Sequel to the latest Rails 3 beta.

Has anyone successfully replaced ActiveRecord with Sequel in a Rails 3 project? Could you provide some hints on how to best go about it?

I'm interested in starting a new project on Rails 3 and trying to get off on the right foot: ideally sequel, minitest, and omniauth (with devise if it won't be painful). I know this is not the blessed stack, but these gems appeal to my spidey sense. I'm looking for any advice that will help me work through any gem issues and conflicts.

Answer Source

I've used Sequel with Rails 2 and 3. If you aren't using any of the ActiveRecord integration features, it's actually easy even with Rails 2, you just have to set up the Sequel database connection manually either in an environment file (environment.rb or environments/*.rb), or in an initializer. Your Sequel models still go in app/models/.

With Rails 3 and the Sequel active_model plugin, integration should work fine from a code perspective. Most of what the github repos do is deal with things like rake tasks and generators, which while nice, are not actually necessary.