attr_encrypted 1.0.8 → 1.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README.markdown
CHANGED
@@ -9,7 +9,7 @@ It works with ANY class, however, you get a few extra features when you're using
|
|
9
9
|
Installation
|
10
10
|
------------
|
11
11
|
|
12
|
-
gem install
|
12
|
+
gem install attr_encrypted --source http://gemcutter.org
|
13
13
|
|
14
14
|
|
15
15
|
Usage
|
@@ -43,8 +43,7 @@ Encrypting attributes has never been easier:
|
|
43
43
|
|
44
44
|
### Specifying the encrypted attribute name ###
|
45
45
|
|
46
|
-
By default, the encrypted attribute name is `encrypted_#{attribute}` (e.g. `attr_encrypted :email` would create an attribute named `encrypted_email`).
|
47
|
-
You have a couple of options if you want to name your attribute something else.
|
46
|
+
By default, the encrypted attribute name is `encrypted_#{attribute}` (e.g. `attr_encrypted :email` would create an attribute named `encrypted_email`). So, if you're storing the encrypted attribute in the database, you need to make sure the `encrypted_#{attribute}` field exists in your table. You have a couple of options if you want to name your attribute something else.
|
48
47
|
|
49
48
|
#### The `:attribute` option ####
|
50
49
|
|
data/lib/attr_encrypted.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
gem 'eigenclass', '>= 1.0.1'
|
2
2
|
require 'eigenclass'
|
3
3
|
|
4
|
-
gem 'encryptor'
|
4
|
+
gem 'encryptor', '>= 1.0.0'
|
5
5
|
require 'encryptor'
|
6
6
|
|
7
7
|
module Huberry
|
@@ -223,4 +223,4 @@ end
|
|
223
223
|
|
224
224
|
Object.extend Huberry::AttrEncrypted
|
225
225
|
|
226
|
-
Dir[File.join(File.dirname(__FILE__), 'huberry', 'attr_encrypted', 'adapters', '*.rb')].each { |file| require file }
|
226
|
+
Dir[File.join(File.dirname(__FILE__), 'huberry', 'attr_encrypted', 'adapters', '*.rb')].each { |file| require file }
|
@@ -13,8 +13,9 @@ if defined?(ActiveRecord)
|
|
13
13
|
# Ensures the attribute methods for db fields have been defined before calling the original
|
14
14
|
# <tt>attr_encrypted</tt> method
|
15
15
|
def attr_encrypted(*attrs)
|
16
|
-
define_attribute_methods
|
16
|
+
define_attribute_methods rescue nil
|
17
17
|
super
|
18
|
+
attrs.reject { |attr| attr.is_a?(Hash) }.each { |attr| alias_method "#{attr}_before_type_cast", attr }
|
18
19
|
end
|
19
20
|
|
20
21
|
# Allows you to use dynamic methods like <tt>find_by_email</tt> or <tt>scoped_by_email</tt> for
|
data/test/active_record_test.rb
CHANGED
@@ -25,6 +25,7 @@ class Person < ActiveRecord::Base
|
|
25
25
|
def after_initialize
|
26
26
|
self.salt ||= Digest::SHA256.hexdigest((Time.now.to_i * rand(5)).to_s)
|
27
27
|
self.credentials ||= { :username => 'example', :password => 'test' }
|
28
|
+
rescue ActiveRecord::MissingAttributeError
|
28
29
|
end
|
29
30
|
end
|
30
31
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: attr_encrypted
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sean Huber
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-01-
|
12
|
+
date: 2009-01-14 00:00:00 -08:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -50,7 +50,7 @@ files:
|
|
50
50
|
- Rakefile
|
51
51
|
- README.markdown
|
52
52
|
- test/test_helper.rb
|
53
|
-
has_rdoc:
|
53
|
+
has_rdoc: true
|
54
54
|
homepage: http://github.com/shuber/attr_encrypted
|
55
55
|
licenses: []
|
56
56
|
|