lib/gtfs/realtime/configuration.rb in gtfs-realtime-0.3.0 vs lib/gtfs/realtime/configuration.rb in gtfs-realtime-0.4.0
- old
+ new
@@ -1,18 +1,17 @@
module GTFS
class Realtime
class Configuration
- attr_accessor :static_feed, :trip_updates_feed, :vehicle_positions_feed, :service_alerts_feed, :database_path
+ attr_accessor :static_feed, :trip_updates_feed, :vehicle_positions_feed, :service_alerts_feed, :database_url
- def database_path=(new_path)
- @database_path = new_path
+ def database_url=(new_path)
+ @database_url = new_path
- # now that we know the DB path, we can initialize the database
- require 'gtfs/realtime/database'
- GTFS::Realtime::Database.path = database_path
-
- # now that we have a database, initialize all the other models
- require 'gtfs/realtime/bootstrap'
+ if @database_url
+ ActiveRecord::Base.establish_connection(@database_url)
+ else
+ ActiveRecord::Base.establish_connection(adapter: 'sqlite3', database: ':memory:')
+ end
end
end
end
end