ubiquitous_user 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +4 -5
- data/Rakefile +1 -0
- data/VERSION +1 -1
- data/generators/ubiquitous_user/USAGE +1 -0
- data/generators/ubiquitous_user/ubiquitous_user.rb +7 -0
- data/lib/ubiquitous_user.rb +14 -6
- data/test/helper.rb +0 -3
- metadata +3 -5
- data/.document +0 -5
- data/.gitignore +0 -22
data/README.rdoc
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
=
|
1
|
+
= Ubiquitous User
|
2
2
|
|
3
3
|
Many web applications required you to log in before being able to interact with
|
4
4
|
them; which poses a real barer of entry for new users. You need users to have
|
@@ -18,8 +18,7 @@ actions that really require a logged in user.
|
|
18
18
|
An important consideration is that users should be mergeable now. If you have
|
19
19
|
a user with an account, and that user comes back a month latter, he may start
|
20
20
|
to operate your site with the new ghost account and only log in latter on. At
|
21
|
-
that moment
|
22
|
-
calling real_account.merge(ghost_account_id)
|
21
|
+
that moment you should merge the accounts.
|
23
22
|
|
24
23
|
== Installation
|
25
24
|
|
@@ -127,8 +126,8 @@ configurable yet. What is configurable is the two methods it calls on user. You
|
|
127
126
|
can do this kind of configuration in config/initializers/ubiquitous_user.rb for
|
128
127
|
example:
|
129
128
|
|
130
|
-
|
131
|
-
|
129
|
+
UsableConfig::user_model_save = :save_bypassing_non_essential_validation
|
130
|
+
UsableConfig::user_model_name = :name_or_else
|
132
131
|
|
133
132
|
== API Documentation
|
134
133
|
|
data/Rakefile
CHANGED
@@ -11,6 +11,7 @@ begin
|
|
11
11
|
gem.homepage = "http://github.com/pupeno/ubiquitous_user"
|
12
12
|
gem.authors = ["J. Pablo Fernández"]
|
13
13
|
gem.add_dependency "actionpack", ">= 2.0.0"
|
14
|
+
gem.files = %w(LICENSE README.rdoc Rakefile VERSION) + Dir.glob("{lib,generators}/**/*")
|
14
15
|
#gem.add_development_dependency "thoughtbot-shoulda", ">= 0"
|
15
16
|
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
16
17
|
end
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.1
|
@@ -0,0 +1 @@
|
|
1
|
+
blah blah
|
data/lib/ubiquitous_user.rb
CHANGED
@@ -1,3 +1,15 @@
|
|
1
|
+
module UsableConfig
|
2
|
+
@user_model_save = :save
|
3
|
+
@user_model_name = :name
|
4
|
+
|
5
|
+
# Method used to save the user.
|
6
|
+
attr_accessor :user_model_save
|
7
|
+
# Method used to get the name of the user.
|
8
|
+
attr_accessor :user_model_name
|
9
|
+
|
10
|
+
module_function :user_model_save, :user_model_save=, :user_model_name, :user_model_name=
|
11
|
+
end
|
12
|
+
|
1
13
|
module UsableHelpers
|
2
14
|
# Helper method to get the current user. It will always return a user but the
|
3
15
|
# user may not be in the database. If options[:create] is true, then the user
|
@@ -14,8 +26,7 @@ module UsableHelpers
|
|
14
26
|
@ubiquitous_user = User.new()
|
15
27
|
if options[:create]
|
16
28
|
# Save the user in the database and set the session user_id for latter.
|
17
|
-
|
18
|
-
@ubiquitous_user.send(Usable::UserModelSave)
|
29
|
+
@ubiquitous_user.send(UsableConfig::user_model_save)
|
19
30
|
session[:user_id] = @ubiquitous_user.id
|
20
31
|
end
|
21
32
|
return @ubiquitous_user
|
@@ -34,12 +45,9 @@ end
|
|
34
45
|
module Usable
|
35
46
|
include UsableHelpers
|
36
47
|
|
37
|
-
UserModelSave = :save
|
38
|
-
UserModelName = :name
|
39
|
-
|
40
48
|
def user=(u)
|
41
49
|
session[:user_id] = u != nil ? u.id : nil
|
42
|
-
session[:user_name] = u != nil ? u.send(
|
50
|
+
session[:user_name] = u != nil ? u.send(UsableConfig::user_model_name) : nil
|
43
51
|
user
|
44
52
|
end
|
45
53
|
|
data/test/helper.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ubiquitous_user
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- "J. Pablo Fern\xC3\xA1ndez"
|
@@ -32,15 +32,13 @@ extra_rdoc_files:
|
|
32
32
|
- LICENSE
|
33
33
|
- README.rdoc
|
34
34
|
files:
|
35
|
-
- .document
|
36
|
-
- .gitignore
|
37
35
|
- LICENSE
|
38
36
|
- README.rdoc
|
39
37
|
- Rakefile
|
40
38
|
- VERSION
|
39
|
+
- generators/ubiquitous_user/USAGE
|
40
|
+
- generators/ubiquitous_user/ubiquitous_user.rb
|
41
41
|
- lib/ubiquitous_user.rb
|
42
|
-
- test/helper.rb
|
43
|
-
- test/test_ubiquitous-user.rb
|
44
42
|
has_rdoc: true
|
45
43
|
homepage: http://github.com/pupeno/ubiquitous_user
|
46
44
|
licenses: []
|
data/.document
DELETED