devision 0.0.2.2 → 0.0.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/devision/models/authenticatable.rb +6 -5
- data/lib/devision/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b15e07ae7382ffc1153ea795e73667c18a077ddf
|
4
|
+
data.tar.gz: b36db7927617a6e1fa1f23ef4159fbe5d8d693da
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cfcacbd189d5955be5b0950d17a7990816e5ded36a237e4dcbdf77465467ee053863665ac3fe6b9f2b3c88b51dd3b36a4f704e6c02572ef8e5860c1805baba69
|
7
|
+
data.tar.gz: ffc7be29a867e9cdf4c26169a162c7bc66c8c9f3d8d7abb2f2b59ad5d69c1d733ebac36041edc50f2646f5576c15a7f43d55692a41fff045cf807a2cc610e71d
|
@@ -1,4 +1,5 @@
|
|
1
1
|
module Devision
|
2
|
+
module Models
|
2
3
|
module Authenticatable
|
3
4
|
|
4
5
|
extend ActiveSupport::Concern
|
@@ -6,7 +7,7 @@ module Devision
|
|
6
7
|
def self.required_fields(klass)
|
7
8
|
[]
|
8
9
|
end
|
9
|
-
|
10
|
+
|
10
11
|
|
11
12
|
module ClassMethods
|
12
13
|
|
@@ -17,11 +18,11 @@ module Devision
|
|
17
18
|
def find_or_initialize_with_error_by(attribute, value, error=:invalid)
|
18
19
|
find_or_initialize_with_errors([attribute], { attribute => value }, error)
|
19
20
|
end
|
20
|
-
|
21
|
+
|
21
22
|
def find_or_initialize_with_errors(required_attributes, attributes, error=:invalid)
|
22
23
|
attributes = attributes.slice(*required_attributes)
|
23
24
|
attributes.delete_if { |key, value| value.blank? }
|
24
|
-
|
25
|
+
|
25
26
|
if attributes.size == required_attributes.size
|
26
27
|
record = find_first_by_auth_conditions(attributes)
|
27
28
|
end
|
@@ -34,11 +35,11 @@ module Devision
|
|
34
35
|
record.errors.add(key, value.present? ? error : :blank)
|
35
36
|
end
|
36
37
|
end
|
37
|
-
|
38
|
+
|
38
39
|
record
|
39
40
|
end
|
40
41
|
|
41
42
|
end
|
42
|
-
|
43
|
+
end
|
43
44
|
end
|
44
45
|
end
|
data/lib/devision/version.rb
CHANGED