./lib/rack/push-notification.rb in rack-push-notification-0.5.0 vs ./lib/rack/push-notification.rb in rack-push-notification-0.5.1
- old
+ new
@@ -15,11 +15,11 @@
autoload :Device, 'rack/push-notification/models/device'
configure do
if ENV['DATABASE_URL']
- Sequel.extension :pg_array, :migration
+ Sequel.extension :pg_inet, :pg_array, :migration
DB = Sequel.connect(ENV['DATABASE_URL'])
DB.extend Sequel::Postgres::PGArray::DatabaseMethods
Sequel::Migrator.run(DB, ::File.join(::File.dirname(__FILE__), 'push-notification/migrations'), table: 'push_notification_schema_info')
end
@@ -32,10 +32,10 @@
put '/devices/:token/?' do
param :languages, Array
param :tags, Array
record = Device.find(token: params[:token]) || Device.new
- record.set(params)
+ record.set(params.update({ip_address: request.ip}))
code = record.new? ? 201 : 200
if record.save
status code