devise_invitable 0.6.1 → 1.0.0

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
@@ -12,8 +12,8 @@ Install DeviseInvitable gem, it will also install dependencies (such as devise a
12
12
 
13
13
  Add DeviseInvitable to your Gemfile (and Devise if you weren't using them):
14
14
 
15
- gem 'devise', '~> 1.2.0'
16
- gem 'devise_invitable', '~> 0.4.0'
15
+ gem 'devise', '~> 2.0.0'
16
+ gem 'devise_invitable', '~> 0.7.0'
17
17
 
18
18
  === Automatic installation
19
19
 
@@ -41,7 +41,13 @@ Add t.invitable to your Devise model migration:
41
41
 
42
42
  create_table :users do
43
43
  ...
44
- t.invitable
44
+ ## Invitable
45
+ t.string :invitation_token, :limit => 60
46
+ t.datetime :invitation_sent_at
47
+ t.datetime :invitation_accepted_at
48
+ t.integer :invitation_limit
49
+ t.integer :invited_by_id
50
+ t.string :invited_by_type
45
51
  ...
46
52
  end
47
53
  add_index :users, :invitation_token
@@ -49,10 +55,13 @@ Add t.invitable to your Devise model migration:
49
55
  or for a model that already exists, define a migration to add DeviseInvitable to your model:
50
56
 
51
57
  change_table :users do |t|
52
- t.string :invitation_token, :limit => 60
53
- t.datetime :invitation_sent_at
54
- t.datetime :invitation_accepted_at
55
- t.index :invitation_token
58
+ t.string :invitation_token, :limit => 60
59
+ t.datetime :invitation_sent_at
60
+ t.datetime :invitation_accepted_at
61
+ t.integer :invitation_limit
62
+ t.integer :invited_by_id
63
+ t.string :invited_by_type
64
+
56
65
  end
57
66
 
58
67
  # Allow null encrypted_password
@@ -1,5 +1,4 @@
1
- class Devise::InvitationsController < ApplicationController
2
- include Devise::Controllers::InternalHelpers
1
+ class Devise::InvitationsController < DeviseController
3
2
 
4
3
  before_filter :authenticate_inviter!, :only => [:new, :create]
5
4
  before_filter :has_invitations_left?, :only => [:create]
@@ -9,7 +8,7 @@ class Devise::InvitationsController < ApplicationController
9
8
  # GET /resource/invitation/new
10
9
  def new
11
10
  build_resource
12
- render_with_scope :new
11
+ render :new
13
12
  end
14
13
 
15
14
  # POST /resource/invitation
@@ -20,14 +19,14 @@ class Devise::InvitationsController < ApplicationController
20
19
  set_flash_message :notice, :send_instructions, :email => self.resource.email
21
20
  respond_with resource, :location => after_invite_path_for(resource)
22
21
  else
23
- respond_with_navigational(resource) { render_with_scope :new }
22
+ respond_with_navigational(resource) { render :new }
24
23
  end
25
24
  end
26
25
 
27
26
  # GET /resource/invitation/accept?invitation_token=abcdef
28
27
  def edit
29
28
  if params[:invitation_token] && self.resource = resource_class.to_adapter.find_first( :invitation_token => params[:invitation_token] )
30
- render_with_scope :edit
29
+ render :edit
31
30
  else
32
31
  set_flash_message(:alert, :invitation_token_invalid)
33
32
  redirect_to after_sign_out_path_for(resource_name)
@@ -43,7 +42,7 @@ class Devise::InvitationsController < ApplicationController
43
42
  sign_in(resource_name, resource)
44
43
  respond_with resource, :location => after_accept_path_for(resource)
45
44
  else
46
- respond_with_navigational(resource){ render_with_scope :edit }
45
+ respond_with_navigational(resource){ render :edit }
47
46
  end
48
47
  end
49
48
 
@@ -56,7 +55,7 @@ class Devise::InvitationsController < ApplicationController
56
55
  unless current_inviter.nil? || current_inviter.has_invitations_left?
57
56
  build_resource
58
57
  set_flash_message :alert, :no_invitations_remaining
59
- respond_with_navigational(resource) { render_with_scope :new }
58
+ respond_with_navigational(resource) { render :new }
60
59
  end
61
60
  end
62
61
 
@@ -6,7 +6,6 @@ end
6
6
 
7
7
  require 'devise_invitable/mailer'
8
8
  require 'devise_invitable/routes'
9
- require 'devise_invitable/schema'
10
9
  require 'devise_invitable/controllers/url_helpers'
11
10
  require 'devise_invitable/controllers/helpers'
12
11
  require 'devise_invitable/rails'
@@ -1,3 +1,3 @@
1
1
  module DeviseInvitable
2
- VERSION = '0.6.1'
2
+ VERSION = '1.0.0'
3
3
  end
@@ -1,5 +1,5 @@
1
1
  class DeviseInvitableAddTo<%= table_name.camelize %> < ActiveRecord::Migration
2
- def self.up
2
+ def up
3
3
  change_table :<%= table_name %> do |t|
4
4
  t.string :invitation_token, :limit => 60
5
5
  t.datetime :invitation_sent_at
@@ -9,15 +9,15 @@ class DeviseInvitableAddTo<%= table_name.camelize %> < ActiveRecord::Migration
9
9
  t.index :invitation_token # for invitable
10
10
  t.index :invited_by_id
11
11
  end
12
-
12
+
13
13
  # And allow null encrypted_password and password_salt:
14
14
  change_column_null :<%= table_name %>, :encrypted_password, true
15
15
  <% if class_name.constantize.columns_hash['password_salt'] -%>
16
16
  change_column_null :<%= table_name %>, :password_salt, true
17
17
  <% end -%>
18
18
  end
19
-
20
- def self.down
19
+
20
+ def down
21
21
  change_table :<%= table_name %> do |t|
22
22
  t.remove_references :invited_by, :polymorphic => true
23
23
  t.remove :invitation_limit, :invitation_sent_at, :invitation_accepted_at, :invitation_token
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: 5
4
+ hash: 23
5
5
  prerelease:
6
6
  segments:
7
- - 0
8
- - 6
9
7
  - 1
10
- version: 0.6.1
8
+ - 0
9
+ - 0
10
+ version: 1.0.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Sergio Cambra
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-12-27 00:00:00 Z
18
+ date: 2012-01-31 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: bundler
@@ -41,12 +41,11 @@ dependencies:
41
41
  requirements:
42
42
  - - ~>
43
43
  - !ruby/object:Gem::Version
44
- hash: 3
44
+ hash: 7
45
45
  segments:
46
46
  - 3
47
- - 1
48
47
  - 0
49
- version: 3.1.0
48
+ version: "3.0"
50
49
  type: :runtime
51
50
  version_requirements: *id002
52
51
  - !ruby/object:Gem::Dependency
@@ -55,21 +54,14 @@ dependencies:
55
54
  requirement: &id003 !ruby/object:Gem::Requirement
56
55
  none: false
57
56
  requirements:
58
- - - ">="
59
- - !ruby/object:Gem::Version
60
- hash: 11
61
- segments:
62
- - 1
63
- - 4
64
- - 6
65
- version: 1.4.6
66
- - - <
57
+ - - ~>
67
58
  - !ruby/object:Gem::Version
68
- hash: 3
59
+ hash: 15
69
60
  segments:
70
- - 1
71
- - 6
72
- version: "1.6"
61
+ - 2
62
+ - 0
63
+ - 0
64
+ version: 2.0.0
73
65
  type: :runtime
74
66
  version_requirements: *id003
75
67
  description: It adds support for send invitations by email (it requires to be authenticated) and accept the invitation by setting a password.
@@ -92,7 +84,6 @@ files:
92
84
  - lib/devise_invitable/model.rb
93
85
  - lib/devise_invitable/rails.rb
94
86
  - lib/devise_invitable/routes.rb
95
- - lib/devise_invitable/schema.rb
96
87
  - lib/devise_invitable/controllers/helpers.rb
97
88
  - lib/devise_invitable/controllers/url_helpers.rb
98
89
  - lib/devise_invitable/version.rb
@@ -1,38 +0,0 @@
1
- module DeviseInvitable
2
- module Schema
3
- # Add invitation_token and invitation_sent_at columns in the resource's database table.
4
- #
5
- # Examples
6
- #
7
- # # For a new resource migration:
8
- # create_table :the_resources do
9
- # t.database_authenticatable :null => false # you need at least this
10
- # t.invitable
11
- # ...
12
- # end
13
- # add_index :the_resources, :invitation_token # for invitable
14
- #
15
- # # or if the resource's table already exists, define a migration and put this in:
16
- # change_table :the_resources do |t|
17
- # t.string :invitation_token, :limit => 60
18
- # t.datetime :invitation_sent_at
19
- # t.datetime :invitation_accepted_at
20
- # t.index :invitation_token # for invitable
21
- # end
22
- #
23
- # # And allow encrypted_password to be null:
24
- # change_column :the_resources, :encrypted_password, :string, :null => true
25
- # # the following line is only if you use Devise's encryptable module!
26
- # change_column :the_resources, :password_salt, :string, :null => true
27
- def invitable
28
- apply_devise_schema :invitation_token, String, :limit => 60
29
- apply_devise_schema :invitation_sent_at, DateTime
30
- apply_devise_schema :invitation_accepted_at, DateTime
31
- apply_devise_schema :invitation_limit, Integer
32
- apply_devise_schema :invited_by_id, Integer
33
- apply_devise_schema :invited_by_type, String
34
- end
35
- end
36
- end
37
-
38
- Devise::Schema.send :include, DeviseInvitable::Schema