Created
April 26, 2011 23:22
-
-
Save lumpidu/943399 to your computer and use it in GitHub Desktop.
Initialize DataMapper connections in different classes
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
class RssSqliteModel | |
def initialize(path) | |
# logs display | |
DataMapper::Logger.new($stdout, :debug) | |
DataMapper.setup(:default, "sqlite://#{path}") | |
DataMapper.finalize | |
DataMapper.auto_migrate! | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Let's assume we have a script that either initializes a postgresql or a sqlite connection by using the same model as in https://gist.github.com/943379: where exactly may the model be placed and the initialization to RssSqliteModel be called ?