Skip to content

ActiveModel::Dirty support not working #335

Description

@aidandamerell

The attribute_was method does not appear to return the old value from an encrypted value:

class Person < ApplicationRecord
	attr_encrypted :email, key: "Some key"
	before_update :check

	private

	def check
		puts "Old: #{self.email_was}"
		puts "New: #{self.email}"
	end
end

This can be seen in the console:

2.5.3 :006 > Person.first.email
 => "email@email.com"
2.5.3 :006 > Person.first.update(email: "another@email.com")
Old: 
New: another@email.com
=> true

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions