magic_user 0.0.1 → 0.0.2
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.
- data/README.rdoc +27 -0
- data/lib/magic_user/version.rb +1 -1
- metadata +1 -1
data/README.rdoc
CHANGED
@@ -12,3 +12,30 @@ Userstamping can be turned off by setting:
|
|
12
12
|
Use Bundler to install Magic User:
|
13
13
|
|
14
14
|
gem 'magic_user'
|
15
|
+
|
16
|
+
== Usage
|
17
|
+
|
18
|
+
At the moment you have to define User.current somewhere in your app...
|
19
|
+
|
20
|
+
Do something like that:
|
21
|
+
|
22
|
+
class ApplicationController < ActionController::Base
|
23
|
+
before_filter :user_setup
|
24
|
+
|
25
|
+
private
|
26
|
+
|
27
|
+
def user_setup
|
28
|
+
User.current = current_user
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
|
33
|
+
class User < ActiveRecord::Base
|
34
|
+
def self.current=(user)
|
35
|
+
@current_user = user
|
36
|
+
end
|
37
|
+
|
38
|
+
def self.current
|
39
|
+
@current_user
|
40
|
+
end
|
41
|
+
end
|
data/lib/magic_user/version.rb
CHANGED