devise-guests 0.0.1 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
data/devise-guests.gemspec
CHANGED
@@ -9,8 +9,8 @@ Gem::Specification.new do |s|
|
|
9
9
|
s.authors = ["Chris Beer"]
|
10
10
|
s.email = %q{chris@cbeer.info}
|
11
11
|
s.homepage = %q{http://github.com/cbeer/devise-guests}
|
12
|
-
s.summary = %q{
|
13
|
-
s.description = %q{
|
12
|
+
s.summary = %q{ Guest user implementation for devise }
|
13
|
+
s.description = %q{ Guest user implementation for devise }
|
14
14
|
|
15
15
|
s.add_dependency 'devise'
|
16
16
|
|
@@ -28,6 +28,7 @@ module DeviseGuests::Controllers
|
|
28
28
|
class_eval <<-METHODS, __FILE__, __LINE__ + 1
|
29
29
|
define_concern_callbacks :logging_in_#{mapping}
|
30
30
|
|
31
|
+
|
31
32
|
def guest_#{mapping}
|
32
33
|
#{class_name}.find(session[:guest_#{mapping}_id].nil? ? session[:guest_#{mapping}_id] = create_guest_#{mapping}.id : session[:guest_#{mapping}_id])
|
33
34
|
end
|
@@ -48,10 +49,20 @@ module DeviseGuests::Controllers
|
|
48
49
|
|
49
50
|
private
|
50
51
|
def create_guest_#{mapping}
|
51
|
-
u = #{class_name}.create(:email => "guest_#{
|
52
|
+
u = #{class_name}.create(:email => "guest_" + guest_#{mapping}_unique_suffix + "@example.com")
|
52
53
|
u.save(:validate => false)
|
53
54
|
u
|
54
55
|
end
|
56
|
+
|
57
|
+
def guest_#{mapping}_unique_suffix
|
58
|
+
Devise.friendly_token + "_" + Time.now.to_i.to_s + "_" + unique_#{mapping}_counter.to_s
|
59
|
+
end
|
60
|
+
|
61
|
+
def unique_#{mapping}_counter
|
62
|
+
@@unique_#{mapping}_counter ||= 0
|
63
|
+
@@unique_#{mapping}_counter += 1
|
64
|
+
end
|
65
|
+
|
55
66
|
METHODS
|
56
67
|
|
57
68
|
ActiveSupport.on_load(:action_controller) do
|
data/lib/devise-guests/engine.rb
CHANGED
@@ -4,8 +4,9 @@ require 'devise'
|
|
4
4
|
module DeviseGuests
|
5
5
|
class Engine < ::Rails::Engine
|
6
6
|
|
7
|
-
initializer "devise_guests.
|
7
|
+
initializer "devise_guests.add_helpers" do
|
8
8
|
Devise.include_helpers(DeviseGuests::Controllers)
|
9
|
+
Devise.helpers << DeviseGuests::Controllers::Helpers
|
9
10
|
end
|
10
11
|
end
|
11
12
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: devise-guests
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.2.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-10-11 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: devise
|
@@ -123,7 +123,7 @@ dependencies:
|
|
123
123
|
- - ! '>='
|
124
124
|
- !ruby/object:Gem::Version
|
125
125
|
version: '0'
|
126
|
-
description: ! '
|
126
|
+
description: ! ' Guest user implementation for devise '
|
127
127
|
email: chris@cbeer.info
|
128
128
|
executables: []
|
129
129
|
extensions: []
|
@@ -168,7 +168,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
168
168
|
version: '0'
|
169
169
|
segments:
|
170
170
|
- 0
|
171
|
-
hash:
|
171
|
+
hash: -2973806746937180540
|
172
172
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
173
173
|
none: false
|
174
174
|
requirements:
|
@@ -177,13 +177,13 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
177
177
|
version: '0'
|
178
178
|
segments:
|
179
179
|
- 0
|
180
|
-
hash:
|
180
|
+
hash: -2973806746937180540
|
181
181
|
requirements: []
|
182
182
|
rubyforge_project:
|
183
183
|
rubygems_version: 1.8.23
|
184
184
|
signing_key:
|
185
185
|
specification_version: 3
|
186
|
-
summary:
|
186
|
+
summary: Guest user implementation for devise
|
187
187
|
test_files:
|
188
188
|
- spec/controllers/application_controller_spec.rb
|
189
189
|
- spec/helpers/devise_guests_helpers_spec.rb
|