Module: Sinatra::ActiveRecordExtension
- Defined in:
- lib/magistrate_monitor/sinatra-activerecord.rb
Instance Method Summary collapse
Instance Method Details
#database ⇒ Object
21 22 23 24 25 26 27 28 29 |
# File 'lib/magistrate_monitor/sinatra-activerecord.rb', line 21 def database @database ||= if defined?(Rails) ActiveRecord::Base else #ActiveRecord::Base.logger ||= activerecord_logger # Having this enabled overrides Rails TODO: Find a way to make it not override Rails ActiveRecord::Base.establish_connection() ActiveRecord::Base end end |
#database=(cfg) ⇒ Object
15 16 17 18 19 |
# File 'lib/magistrate_monitor/sinatra-activerecord.rb', line 15 def database=(cfg) @database = nil set :database_options, cfg database end |