On May 28, 2:46 pm, Jeremy Evans <[email protected]> wrote:
>
> 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
On May 28, 7:11 pm, dusty <[email protected]> wrote:
> I use sequel in sinatra apps and its pretty easy to use a database.yml
> file with it. You can pass most of the same arguments that Rails uses
> to Sequel.connect.
Thanks for the help. I have found pusewicz-rails_sequel gem and
installed that to play with. I have a stand-alone batch process that
I have written with ActiveRecord so I am going to use it and see how
much trouble I can make for myself by switching to Sequel.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---