Last active
August 29, 2015 14:18
-
-
Save nglx/c54d96e0708f4c614640 to your computer and use it in GitHub Desktop.
Reusing sequel-rails connection in rom-yesql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ROM::Yesql::Repository.class_eval do | |
def initialize(uri, options = {}) | |
super | |
@connection = Sequel::Model.db | |
initialize_queries | |
ROM::Yesql::Relation.query_proc(query_proc) | |
ROM::Yesql::Relation.load_queries(queries) | |
end | |
end |
We have an interface in rom-sql that allows you to inject existing connection - we should add that to rom-yesql too :)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I know I shouldn't monkey patch that 😀