moorage-enlightened_observers 1.0 → 1.0.20080915
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.textile +3 -25
- metadata +1 -1
data/README.textile
CHANGED
@@ -3,18 +3,18 @@ h1. EnlightenedObservers
|
|
3
3
|
This plugin makes it quick and easy to share the controller information with observers, including session information. This is useful when observers need to report the current_user that made a certain action happen.
|
4
4
|
|
5
5
|
The code and idea for this plugin comes from:
|
6
|
-
|
6
|
+
http://scie.nti.st/2007/2/1/let-activerecord-observers-see-controller-context
|
7
7
|
|
8
8
|
|
9
9
|
h2. Usage
|
10
10
|
|
11
|
-
<
|
11
|
+
<code>
|
12
12
|
class MyController < ActionController::Base
|
13
13
|
include EnlightenedObservers
|
14
14
|
|
15
15
|
observer :my_observer
|
16
16
|
end
|
17
|
-
</
|
17
|
+
</code>
|
18
18
|
|
19
19
|
Now my_observer has access to a controller instance variable, which can be used to access the session.
|
20
20
|
e.g.
|
@@ -22,29 +22,7 @@ e.g.
|
|
22
22
|
|
23
23
|
h2. Installation
|
24
24
|
|
25
|
-
To enable the library your Rails 2.1 (or greater) project, use the gem configuration method in "<code>config/environment.rb</code>"
|
26
25
|
|
27
|
-
<pre>
|
28
|
-
Rails::Initializer.run do |config|
|
29
|
-
config.gem 'moorage-enlightened_observers', :lib => 'enlightened_observers', :source => 'http://gems.github.com'
|
30
|
-
end
|
31
|
-
</pre>
|
32
|
-
|
33
|
-
The <code>:lib</code> is important, because rails gets confused when the name of the gem is different from the library.
|
34
|
-
|
35
|
-
And of course, run
|
36
|
-
|
37
|
-
<pre>
|
38
|
-
rake gems:install
|
39
|
-
</pre>
|
40
|
-
|
41
|
-
To get them installed on your system.
|
42
|
-
|
43
|
-
Optionally, to unpack it into your application, just run:
|
44
|
-
|
45
|
-
<pre>
|
46
|
-
rake gems:unpack GEM=moorage-enlightened_observers
|
47
|
-
</pre>
|
48
26
|
|
49
27
|
|
50
28
|
=======
|