lib/lockbox/model.rb in lockbox-0.3.7 vs lib/lockbox/model.rb in lockbox-0.4.0

- old
+ new

@@ -79,10 +79,21 @@ end "#<#{self.class} #{inspection.join(", ")}>" end if activerecord + # TODO wrap in module? + def attributes + # load attributes + # essentially a no-op if already loaded + # an exception is thrown if decryption fails + self.class.lockbox_attributes.each do |_, lockbox_attribute| + send(lockbox_attribute[:attribute]) + end + super + end + # needed for in-place modifications # assigned attributes are encrypted on assignment # and then again here before_save do self.class.lockbox_attributes.each do |_, lockbox_attribute| @@ -388,15 +399,9 @@ raise "Duplicate encrypted attachment: #{name}" if lockbox_attachments[name] @lockbox_attachments[name] = options end end - end - - # TODO remove in future version - def attached_encrypted(attribute, **options) - warn "[lockbox] DEPRECATION WARNING: Use encrypts_attached instead" - encrypts_attached(attribute, **options) end end end end