20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
# File 'lib/activerecord_acrawriter.rb', line 20
def serialize(value)
return '' if value.to_s.empty?
key = Base64.decode64(Rails.application.secrets.acra_public_key)
acrastruct = create_acrastruct(value.b, key)
case ActiveRecord::Base.connection.adapter_name
when 'PostgreSQL'
return ActiveRecord::Base.connection.escape_bytea(acrastruct)
when 'Mysql2'
return acrastruct.b
end
raise 'Do not know how to operate with adapter ' +
ActiveRecord::Base.connection.adapter_name
end
|