devise_invitable 0.5.4 → 0.5.5
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.
Potentially problematic release.
This version of devise_invitable might be problematic. Click here for more details.
data/README.rdoc
CHANGED
@@ -51,6 +51,7 @@ or for a model that already exists, define a migration to add DeviseInvitable to
|
|
51
51
|
change_table :users do |t|
|
52
52
|
t.string :invitation_token, :limit => 60
|
53
53
|
t.datetime :invitation_sent_at
|
54
|
+
t.datetime :invitation_accepted_at
|
54
55
|
t.index :invitation_token
|
55
56
|
end
|
56
57
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
<h2>Send invitation</h2>
|
2
2
|
|
3
|
-
<%= form_for resource, :as => resource_name, :url => invitation_path(resource_name) do |f| %>
|
3
|
+
<%= form_for resource, :as => resource_name, :url => invitation_path(resource_name), :html => {:method => :post} do |f| %>
|
4
4
|
<%= devise_error_messages! %>
|
5
5
|
|
6
6
|
<p><%= f.label :email %><br />
|
@@ -33,6 +33,7 @@ module Devise
|
|
33
33
|
def accept_invitation!
|
34
34
|
if self.invited? && self.valid?
|
35
35
|
self.invitation_token = nil
|
36
|
+
self.invitation_accepted_at = Time.now.utc
|
36
37
|
self.save
|
37
38
|
end
|
38
39
|
end
|
@@ -44,15 +45,13 @@ module Devise
|
|
44
45
|
|
45
46
|
# Reset invitation token and send invitation again
|
46
47
|
def invite!
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
if
|
53
|
-
|
54
|
-
!!deliver_invitation unless @skip_invitation
|
55
|
-
end
|
48
|
+
@skip_password = true
|
49
|
+
self.skip_confirmation! if self.new_record? && self.respond_to?(:skip_confirmation!)
|
50
|
+
generate_invitation_token if self.invitation_token.nil?
|
51
|
+
self.invitation_sent_at = Time.now.utc
|
52
|
+
if save(:validate => self.class.validate_on_invite)
|
53
|
+
self.invited_by.decrement_invitation_limit! if self.invited_by
|
54
|
+
!!deliver_invitation unless @skip_invitation
|
56
55
|
end
|
57
56
|
end
|
58
57
|
|
@@ -16,6 +16,7 @@ module DeviseInvitable
|
|
16
16
|
# change_table :the_resources do |t|
|
17
17
|
# t.string :invitation_token, :limit => 60
|
18
18
|
# t.datetime :invitation_sent_at
|
19
|
+
# t.datetime :invitation_accepted_at
|
19
20
|
# t.index :invitation_token # for invitable
|
20
21
|
# end
|
21
22
|
#
|
@@ -26,6 +27,7 @@ module DeviseInvitable
|
|
26
27
|
def invitable
|
27
28
|
apply_devise_schema :invitation_token, String, :limit => 60
|
28
29
|
apply_devise_schema :invitation_sent_at, DateTime
|
30
|
+
apply_devise_schema :invitation_accepted_at, DateTime
|
29
31
|
apply_devise_schema :invitation_limit, Integer
|
30
32
|
apply_devise_schema :invited_by_id, Integer
|
31
33
|
apply_devise_schema :invited_by_type, String
|
@@ -3,6 +3,7 @@ class DeviseInvitableAddTo<%= table_name.camelize %> < ActiveRecord::Migration
|
|
3
3
|
change_table :<%= table_name %> do |t|
|
4
4
|
t.string :invitation_token, :limit => 60
|
5
5
|
t.datetime :invitation_sent_at
|
6
|
+
t.datetime :invitation_accepted_at
|
6
7
|
t.integer :invitation_limit
|
7
8
|
t.references :invited_by, :polymorphic => true
|
8
9
|
t.index :invitation_token # for invitable
|
@@ -19,7 +20,7 @@ class DeviseInvitableAddTo<%= table_name.camelize %> < ActiveRecord::Migration
|
|
19
20
|
def self.down
|
20
21
|
change_table :<%= table_name %> do |t|
|
21
22
|
t.remove_references :invited_by, :polymorphic => true
|
22
|
-
t.remove :invitation_limit, :invitation_sent_at, :invitation_token
|
23
|
+
t.remove :invitation_limit, :invitation_sent_at, :invitation_accepted_at, :invitation_token
|
23
24
|
end
|
24
25
|
end
|
25
26
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: devise_invitable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 1
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 5
|
9
|
-
-
|
10
|
-
version: 0.5.
|
9
|
+
- 5
|
10
|
+
version: 0.5.5
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Sergio Cambra
|
@@ -15,8 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-
|
19
|
-
default_executable:
|
18
|
+
date: 2011-09-20 00:00:00 Z
|
20
19
|
dependencies:
|
21
20
|
- !ruby/object:Gem::Dependency
|
22
21
|
name: bundler
|
@@ -106,7 +105,6 @@ files:
|
|
106
105
|
- lib/generators/mongoid/devise_invitable_generator.rb
|
107
106
|
- LICENSE
|
108
107
|
- README.rdoc
|
109
|
-
has_rdoc: true
|
110
108
|
homepage: https://github.com/scambra/devise_invitable
|
111
109
|
licenses: []
|
112
110
|
|
@@ -142,7 +140,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
142
140
|
requirements: []
|
143
141
|
|
144
142
|
rubyforge_project:
|
145
|
-
rubygems_version: 1.
|
143
|
+
rubygems_version: 1.8.10
|
146
144
|
signing_key:
|
147
145
|
specification_version: 3
|
148
146
|
summary: An invitation strategy for Devise
|