4

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.

the Tin Man
  • 158,662
  • 42
  • 215
  • 303
pithyless
  • 1,659
  • 2
  • 16
  • 31

2 Answers2

5

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.

Jeremy Evans
  • 11,959
  • 27
  • 26
  • 3
    Ok, thanks for the vote of confidence. At the moment, I'm actually more inclined just to stick to Sinatra + Sequel; the amount of "stuff" (don't want to call it magic) one needs to wrap his head around in Rails is still a little disconcerting for someone unfamiliar with the terrain. This is precisely why I like Sequel over ActiveRecord: the API is pleasant and follows some path of least surprise. Cheers! – pithyless Apr 20 '11 at 11:58
2

Because sequel-rails no longer seems to be maintained, I looked for forks. The TalentBox version seems to be promising and is actively maintained.

I have to add however, the migrations (rake db:migrate and the like) seem to be somewhat broken. There are some patches in my fork, see the iblue/sequel-rails production branch. I will eventually push them to talentbox, when the are stable.

EDIT: TalentBox is working quite fine now.

iblue
  • 29,609
  • 19
  • 89
  • 128