Skip to content

Instantly share code, notes, and snippets.

@lumpidu
Created April 26, 2011 23:22
Show Gist options
  • Save lumpidu/943399 to your computer and use it in GitHub Desktop.
Save lumpidu/943399 to your computer and use it in GitHub Desktop.
Initialize DataMapper connections in different classes
class RssSqliteModel
def initialize(path)
# logs display
DataMapper::Logger.new($stdout, :debug)
DataMapper.setup(:default, "sqlite://#{path}")
DataMapper.finalize
DataMapper.auto_migrate!
end
end
@lumpidu
Copy link
Author

lumpidu commented Apr 26, 2011

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 ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment