<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -111,11 +111,11 @@ config.awesome_stuff.my_variable # =&gt; &quot;hello world&quot;
 
 h2. Using your configuration in your Rails app
 
-The plugin provides a convenient mixin for your ApplicationController to make configuration access as simple as possible. Assuming a configuration called &quot;application&quot; (as in the above examples), it defines a &lt;code&gt;config&lt;/code&gt; method which can be used in any of your controllers. It also defines this as a method as a view helper using the Rails &lt;code&gt;helper_method&lt;/code&gt; macro so you can access configuration data in your views. 
+The plugin provides a convenient mixin for your &lt;code&gt;ApplicationController&lt;/code&gt; to make configuration access as simple as possible. Assuming a configuration called &quot;application&quot; (as in the above examples), it defines a &lt;code&gt;config&lt;/code&gt; method which can be used in any of your controllers. It also defines this as a method as a view helper using the Rails &lt;code&gt;helper_method&lt;/code&gt; macro so you can access configuration data in your views. 
 
 Note - there is no direct way of accessing your configuration variables in your models other than making a direct call to &lt;code&gt;SimpleConfig.for&lt;/code&gt;. I'd recommend designing your models in such a way that configuration data can be passed into them at runtime as method arguments by your controller to avoid coupling your model to SimpleConfig.
 
-To use the mixin, simply include it in your ApplicationController:
+To use the mixin, simply include it in your &lt;code&gt;ApplicationController&lt;/code&gt;:
 
 &lt;pre&gt;&lt;code class=&quot;ruby&quot;&gt;
 class ApplicationController &lt; ActionController::Base
@@ -133,6 +133,19 @@ class MyController &lt; ApplicationController
 end
 &lt;/code&gt;&lt;/pre&gt;
 
+The mixin provides also a class-level &lt;code&gt;config&lt;/code&gt; method to access the configuration when you don't have a controller instance available.
+
+&lt;pre&gt;&lt;code class=&quot;ruby&quot;&gt;
+class MyController &lt; ApplicationController
+  protect_from_forgery :secret =&gt; config.secret_token
+
+  def index
+    render :text =&gt; config.my_config_variable
+  end
+end
+&lt;/code&gt;&lt;/pre&gt;
+
+
 fn1(footnote). SimpleConfig was designed with Rails 2.0 in mind but it has been tested with Rails 1.2. To use the Rails-style initializers that SimpleConfig takes advantage of in Rails 1.2, simply add this to the bottom of your environment.rb file:
 
 &lt;pre&gt;&lt;code class=&quot;ruby&quot;&gt;</diff>
      <filename>README.textile</filename>
    </modified>
    <modified>
      <diff>@@ -1,11 +1,31 @@
 module SimpleConfig
   module ControllerMixin
-    def self.included(klass)
-      klass.send(:helper_method, :config)
+    
+    def self.included(base)
+      base.extend     ClassMethods
+      base.class_eval do
+        include       InstanceMethods
+        helper_method :config
+      end
+    end
+    
+    module ClassMethods
+      
+      # Returns the application config.
+      def config
+        SimpleConfig.for(:application)
+      end
+      
     end
     
-    def config
-      SimpleConfig.for(:application)
+    module InstanceMethods
+      
+      # Instance-level proxy to class-level +config+ method.
+      def config
+        self.class.config
+      end
+      
     end
+    
   end
 end</diff>
      <filename>lib/controller_mixin.rb</filename>
    </modified>
    <modified>
      <diff>@@ -13,6 +13,7 @@ class RailsController
 end
 
 class ControllerMixinTest &lt; Test::Unit::TestCase
+
   def setup
     @app_config = SimpleConfig.for(:application) do
     end
@@ -20,7 +21,12 @@ class ControllerMixinTest &lt; Test::Unit::TestCase
     @controller_klass = Class.new(RailsController)
   end
   
-  def test_should_define_a_config_method_that_returns_the_application_config_when_included
+  def test_should_define_a_config_class_method_that_returns_the_application_config_when_included
+    @controller_klass.send(:include, SimpleConfig::ControllerMixin)
+    assert_equal @app_config, @controller_klass.config
+  end
+  
+  def test_should_define_a_config_instance_method_that_returns_the_application_config_when_included
     @controller_klass.send(:include, SimpleConfig::ControllerMixin)
     assert_equal @app_config, @controller_klass.new.config
   end</diff>
      <filename>test/controller_mixin_test.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>37f94882341779c1d5332a2ab3f384fb2a62cd10</id>
    </parent>
  </parents>
  <author>
    <name>lukeredpath</name>
    <email>lukeredpath@53438b35-87ee-0310-8825-c8c94c0097b6</email>
  </author>
  <url>http://github.com/lukeredpath/simpleconfig/commit/ec0d69f6f077df8840bdbc48d9e29864263ef308</url>
  <id>ec0d69f6f077df8840bdbc48d9e29864263ef308</id>
  <committed-date>2008-11-05T10:19:54-08:00</committed-date>
  <authored-date>2008-11-05T10:19:54-08:00</authored-date>
  <message>* Let config method to be accessible at class-level.


git-svn-id: http://svn/repos/plugins/simple_config@14123 53438b35-87ee-0310-8825-c8c94c0097b6</message>
  <tree>7eab224252eb70e78485100a08877ed6f2d69db8</tree>
  <committer>
    <name>lukeredpath</name>
    <email>lukeredpath@53438b35-87ee-0310-8825-c8c94c0097b6</email>
  </committer>
</commit>
