Module: Lockbox::Model::Attached
- Defined in:
- lib/lockbox/model.rb
Instance Method Summary collapse
-
#attached_encrypted(attribute, **options) ⇒ Object
TODO remove in future version.
- #encrypts_attached(*attributes, **options) ⇒ Object
Instance Method Details
#attached_encrypted(attribute, **options) ⇒ Object
TODO remove in future version
396 397 398 399 |
# File 'lib/lockbox/model.rb', line 396 def attached_encrypted(attribute, **) warn "[lockbox] DEPRECATION WARNING: Use encrypts_attached instead" encrypts_attached(attribute, **) end |
#encrypts_attached(*attributes, **options) ⇒ Object
369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 |
# File 'lib/lockbox/model.rb', line 369 def encrypts_attached(*attributes, **) attributes.each do |name| name = name.to_sym class_eval do @lockbox_attachments ||= {} if @lockbox_attachments.empty? def self. = if superclass.respond_to?(:lockbox_attachments) superclass. else {} end .merge(@lockbox_attachments || {}) end end raise "Duplicate encrypted attachment: #{name}" if [name] @lockbox_attachments[name] = end end end |