./lib/rack/passbook/models/pass.rb in rack-passbook-0.2.0 vs ./lib/rack/passbook/models/pass.rb in rack-passbook-0.3.0
- old
+ new
@@ -1,25 +1,27 @@
+# frozen_string_literal: true
+
module Rack
class Passbook
class Pass < Sequel::Model
- plugin :json_serializer, naked: true, except: :id
+ 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_passes
self.strict_param_setting = false
self.raise_on_save_failure = false
- one_to_many :registrations, class_name: "Rack::Passbook::Registration"
+ one_to_many :registrations, class_name: 'Rack::Passbook::Registration'
def validate
super
-
- validates_presence [:pass_type_identifier, :serial_number]
+
+ validates_presence %i[pass_type_identifier serial_number]
validates_unique :pass_type_identifier
- validates_unique [:serial_number, :pass_type_identifier]
+ validates_unique %i[serial_number pass_type_identifier]
end
end
end
end