An open API service indexing awesome lists of open source software.

https://github.com/foca/sequel_on_connect

Run callbacks after connecting to a database using the Sequel database toolkit
https://github.com/foca/sequel_on_connect

Last synced: 11 months ago
JSON representation

Run callbacks after connecting to a database using the Sequel database toolkit

Awesome Lists containing this project

README

          

= Sequel.on_connect

Run code immediately after a database connection has been established.

== How to use?

require "sequel"
require "sequel_on_connect"

Sequel.on_connect do
require "my_models"
end

Sequel.connect("sqlite::memory:")

== Why?

`Sequel` requires you to establish a connection *before* loading your
model classes. If, for some reason, you can't establish a connection
before loading your classes, then this will allow you to require them
immediately after you connect to the database.

== Credits

Author:: Nicolás Sanguinetti
License:: Released under an MIT license. Check LICENSE for details.