lib/lockbox.rb in lockbox-0.6.3 vs lib/lockbox.rb in lockbox-0.6.4

- old
+ new

@@ -32,15 +32,19 @@ warn "Active Record version (#{ActiveRecord::VERSION::STRING}) not supported in this version of Lockbox (#{Lockbox::VERSION})" end extend Lockbox::Model extend Lockbox::Model::Attached + # alias_method is private in Ruby < 2.5 + singleton_class.send(:alias_method, :encrypts, :lockbox_encrypts) if ActiveRecord::VERSION::MAJOR < 7 ActiveRecord::Calculations.prepend Lockbox::Calculations end ActiveSupport.on_load(:mongoid) do Mongoid::Document::ClassMethods.include(Lockbox::Model) + # alias_method is private in Ruby < 2.5 + Mongoid::Document::ClassMethods.send(:alias_method, :encrypts, :lockbox_encrypts) end end module Lockbox class Error < StandardError; end @@ -104,9 +108,9 @@ Encryptor.new(**options) end def self.encrypts_action_text_body(**options) ActiveSupport.on_load(:action_text_rich_text) do - ActionText::RichText.encrypts :body, **options + ActionText::RichText.lockbox_encrypts :body, **options end end end