confirmed_attributes 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +3 -9
- data/README.md +3 -1
- data/lib/confirmed_attributes/confirmable.rb +7 -0
- data/lib/confirmed_attributes/version.rb +1 -1
- metadata +3 -4
- data/bin/console +0 -14
- data/bin/setup +0 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0c53f8b00c34c7e12875af6404aaded80bdf1cff
|
4
|
+
data.tar.gz: 14f15f40e0d82dd710ec2d59ed6667fac0b824d1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 137a0001abfcab73a6dd371426b1515ee7754ec4be70e73ebbcf624341786c252942cfa05ea72945a05b57a3250401dfa1d508b18b041f5cc9bce6d171176485
|
7
|
+
data.tar.gz: b594be2970e1d06ed13e5bc3fe3df1d2a1e40164549ce4f146c1ef7045c16f867c37974a7efb577a8488079f589687efe30d6e0c567f3f08ccfe4b96960e6452
|
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -40,9 +40,11 @@ User.confirmable_attributes # => [:email]
|
|
40
40
|
@user.confimed_attributes # => []
|
41
41
|
@user.confirmed_attribute? :email # => false
|
42
42
|
|
43
|
-
@user.confirm :email
|
43
|
+
@user.confirm :email # => true
|
44
44
|
@user.confimed_attributes # => [#<ConfirmedAttributes::Control:0x007f2eacd2f730> name: "email", value: "your_mail"...]
|
45
45
|
@user.confirmed_attribute? :email # => true
|
46
|
+
|
47
|
+
@user.unconfirm :email # => true
|
46
48
|
```
|
47
49
|
|
48
50
|
Simple, yeah?
|
@@ -43,6 +43,13 @@ module ConfirmedAttributes
|
|
43
43
|
confirmed_attribute.verify(attribute_name)
|
44
44
|
end
|
45
45
|
|
46
|
+
def unconfirm(attribute_name, user_id = nil)
|
47
|
+
array = confirmed_attributes.where(name: attribute_name, value: send(attribute_name))
|
48
|
+
return false if new_record? || array.empty?
|
49
|
+
|
50
|
+
!!array.delete_all
|
51
|
+
end
|
52
|
+
|
46
53
|
def confirmable_attribute?(attribute_name)
|
47
54
|
return false if attribute_name.blank?
|
48
55
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: confirmed_attributes
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alexander Shlinchak
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-08-
|
11
|
+
date: 2015-08-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -95,8 +95,6 @@ files:
|
|
95
95
|
- LICENSE.txt
|
96
96
|
- README.md
|
97
97
|
- Rakefile
|
98
|
-
- bin/console
|
99
|
-
- bin/setup
|
100
98
|
- confirmed_attributes.gemspec
|
101
99
|
- lib/confirmed_attributes.rb
|
102
100
|
- lib/confirmed_attributes/confirmable.rb
|
@@ -129,3 +127,4 @@ signing_key:
|
|
129
127
|
specification_version: 4
|
130
128
|
summary: Confirmable attributes for ActiveRecord
|
131
129
|
test_files: []
|
130
|
+
has_rdoc:
|
data/bin/console
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require "bundler/setup"
|
4
|
-
require "test_gem"
|
5
|
-
|
6
|
-
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
-
# with your gem easier. You can also use a different console, if you like.
|
8
|
-
|
9
|
-
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
-
# require "pry"
|
11
|
-
# Pry.start
|
12
|
-
|
13
|
-
require "irb"
|
14
|
-
IRB.start
|