On May 28, 9:57 am, byrnejb <[email protected]> wrote: > I am investigating using Sequel in place of, or perhaps in conjunction > with, ActiveRecord and I have a large number of unanswered questions.. > At the moment I cannot determine from the documentation whether or not > Sequel can be told to get its connection information from config/ > database.yml or if this facility has to be hand crafted and placed in > an initialiser. I have run across discussions where this facility is > implied, but these all had to do with running Sequel with Merb, of > which I know even less than I do of Sequel.
The bin/sequel command line tool has support for database.yml files built in (sequel -e production config/database.yml). However, Sequel the library doesn't support that out of the box, as it's not designed with Rails in mind. It's pretty easy to setup, though, with something like the follow (untested): DB = Sequel.connect(YAML.load(File.read(File.join(RAILS_ROOT, 'database.yml')))[RAILS_ENV]) > My questions are: > > Can Sequel and ActiveRecord models both be active against the same > database under the same Rails instance? Yes. I've done this while converting a large application from ActiveRecord to Sequel. It works fine. > Does Sequel come with a built in ability to obtain connection data > from config/database.yml when used with Rails? If so, how is it > triggered? If not then does anyone know of a plug in or code snippet > that would provide this facility, rather than having to roll my own? It's so simple I don't think you should bother with an extension, but it's possible the rails_sequel extension does this (http://github.com/ pusewicz/rails_sequel). I haven't looked at it, though. > I have found a rake task to handle migrations in a manner similar to > AR (http://github.com/pusewicz/rails_sequel/blob/ > 8ac45e4b329aa3cef8f819435cdce09071844c32/tasks/sequel.rake) but I am > wondering if this sort of facility was kept out of the distribution > for a reason. Was it? The bin/sequel command line tool runs migrations for you: sequel -m db/migrate -e production config/database.yml Jeremy --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sequel-talk" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/sequel-talk?hl=en -~----------~----~----~----~------~----~------~--~---
