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
- Host: GitHub
- URL: https://github.com/foca/sequel_on_connect
- Owner: foca
- License: mit
- Created: 2009-05-13T17:26:41.000Z (about 17 years ago)
- Default Branch: master
- Last Pushed: 2009-05-13T17:27:08.000Z (about 17 years ago)
- Last Synced: 2023-04-10T10:20:05.384Z (about 3 years ago)
- Language: Ruby
- Homepage:
- Size: 70.3 KB
- Stars: 4
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.rdoc
- License: LICENSE
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.