Module: Redmine::Ciphering::ClassMethods

Defined in:
lib/redmine/ciphering.rb

Instance Method Summary collapse

Instance Method Details

#decrypt_all(attribute) ⇒ Object

Since:

  • 3.4.0



80
81
82
83
84
85
86
87
88
# File 'lib/redmine/ciphering.rb', line 80

def decrypt_all(attribute)
  transaction do
    all.each do |object|
      clear = object.send(attribute)
      object.send :write_attribute, attribute, clear
      raise(ActiveRecord::Rollback) unless object.save(:validation => false)
    end
  end ? true : false
end

#encrypt_all(attribute) ⇒ Object

Since:

  • 1.2.0



70
71
72
73
74
75
76
77
78
# File 'lib/redmine/ciphering.rb', line 70

def encrypt_all(attribute)
  transaction do
    all.each do |object|
      clear = object.send(attribute)
      object.send "#{attribute}=", clear
      raise(ActiveRecord::Rollback) unless object.save(:validation => false)
    end
  end ? true : false
end