Class: OpenDbSession
- Inherits:
-
Object
- Object
- OpenDbSession
- Defined in:
- lib/dandy/generators/templates/actions/common/open_db_session.rb
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(container, dandy_config, dandy_env) ⇒ OpenDbSession
constructor
A new instance of OpenDbSession.
Constructor Details
#initialize(container, dandy_config, dandy_env) ⇒ OpenDbSession
Returns a new instance of OpenDbSession.
6 7 8 9 10 |
# File 'lib/dandy/generators/templates/actions/common/open_db_session.rb', line 6 def initialize(container, dandy_config, dandy_env) @container = container @config = dandy_config @dandy_env = dandy_env end |
Instance Method Details
#call ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/dandy/generators/templates/actions/common/open_db_session.rb', line 12 def call # Instead of :url you can specify required Sequel connection parameters in dandy.yml. # Additional details about Sequel connection configuration # see at http://sequel.jeremyevans.net/rdoc/files/doc/opening_databases_rdoc.html connection = Sequel.connect(@config[:db][:url]) if @dandy_env == 'development' connection.loggers << Logger.new($stdout) end JetSet::open_session(connection, :dandy_request) end |