./lib/rack/passbook/models/pass.rb in rack-passbook-0.0.1 vs ./lib/rack/passbook/models/pass.rb in rack-passbook-0.0.2
- old
+ new
@@ -1,17 +1,19 @@
module Rack
class Passbook
- DB = Sequel.connect(ENV['DATABASE_URL'] || "postgres://localhost:5432/passbook_example")
- Sequel::Migrator.run(DB, ::File.join(::File.dirname(__FILE__), "../migrations"))
+ if ENV['DATABASE_URL']
+ DB = Sequel.connect(ENV['DATABASE_URL'])
+ Sequel::Migrator.run(DB, ::File.join(::File.dirname(__FILE__), "../migrations"))
+ end
class Pass < Sequel::Model
plugin :json_serializer, naked: true, except: :id
plugin :validation_helpers
plugin :timestamps, force: true, update_on_create: true
plugin :schema
plugin :typecast_on_load
- self.dataset = :passbook_devices
+ self.dataset = :passbook_passes
self.strict_param_setting = false
self.raise_on_save_failure = false
one_to_many :registrations, class_name: "Rack::Passbook::Registration"