<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -6,13 +6,14 @@ like methods for manipulation.  Keep track of any global setting that you dont w
 to hard code into your rails app.  You can store any kind of object.  Strings, numbers,
 arrays, or any object.
 
+
 == Setup
 
 You must create the table used by the Settings model.  Simply run this command:
   ruby script/generate settings_migration
 
 Now just put that migration in the database with:
-  rake migrate
+  rake db:migrate
 
 
 == Usage
@@ -35,25 +36,21 @@ Changing an existing setting is the same as creating a new setting:
 Decide you dont want to track a particular setting anymore?
 
   Settings.destroy :foo
-  Settings.foo            # Now gives a setting variable not found error.
+  Settings.foo            # returns nil
 
 Want a list of all the settings?
 
   Settings.all            # returns {'admin_password' =&gt; 'super_secret', 'date_format' =&gt; '%m %d, %Y'}
 
 Set defaults for certain settings of your app.  This will cause the defined settings to return with the
-Specified value even if they are not in the database.  Here is what you insert into your environment.rb
-
-  module SettingsDefaults
-    DEFAULTS = {
-      :setting_one =&gt; 'footastic',
-      :setting_two =&gt; 123.321
-    }
-  end
+Specified value even if they are not in the database.  Make a new file in config/initializers/settings.rb
+with the following:
+
+  Settings.defaults[:some_setting] = 'footastic'
   
-  Settings.setting_one          #=&gt; returns &quot;footastic&quot; even though no record is in the databse for &quot;some_setting&quot;
-  Settings.setting_one = 'bar'  # Database record is now created and 'bar' will be used instead of the default.
+Now even if the database is completely empty, you app will have some intelligent defaults:
+
+  Settings.some_setting   # returns 'footastic'
 
-NOTE: the server must be restarted in order to see new default settings.
 
-All there is to it!. Enjoy!
\ No newline at end of file
+That's all there is to it!. Enjoy!
\ No newline at end of file</diff>
      <filename>README.rdoc</filename>
    </modified>
    <modified>
      <diff>@@ -1,10 +1,9 @@
 class &lt;%= class_name %&gt; &lt; ActiveRecord::Migration
   def self.up
     create_table :settings, :force =&gt; true do |t|
-        t.column :var, :string, :null =&gt; false
-        t.column :value, :text, :null =&gt; true
-        t.column :created_at, :datetime
-        t.column :updated_at, :datetime
+      t.string :var, :null =&gt; false
+      t.text   :value, :null =&gt; true
+      t.timestamps
     end
   end
 </diff>
      <filename>generators/settings_migration/templates/migration.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,22 +1,30 @@
 class Settings &lt; ActiveRecord::Base
-  # @@defaults  = (defined?(SettingsDefaults) ? SettingsDefaults::DEFAULTS : {}).with_indifferent_access
-  
   class SettingNotFound &lt; RuntimeError; end
   
+  cattr_accessor :defaults
+  @@defaults = {}.with_indifferent_access
+  
+  # Support old plugin
+  if defined?(SettingsDefaults::DEFAULTS)
+    @@defaults = SettingsDefaults::DEFAULTS.with_indifferent_access
+  end
+  
   #get or set a variable with the variable as the called method
   def self.method_missing(method, *args)
     method_name = method.to_s
     super(method, *args)
     
   rescue NoMethodError
-    if method_name[-1..-1] == '='
-      #set a value for a variable
+    #set a value for a variable
+    if method_name =~ /=$/
       var_name = method_name.gsub('=', '')
       value = args.first
       self[var_name] = value
+    
+    #retrieve a value
     else
-      #retrieve a value
       self[method_name]
+      
     end
   end
   
@@ -44,16 +52,10 @@ class Settings &lt; ActiveRecord::Base
   
   #retrieve a setting value by [] notation
   def self.[](var_name)
-    #Ensure defaults are loaded
-    @@defaults ||= (defined?(SettingsDefaults) ? SettingsDefaults::DEFAULTS : {}).with_indifferent_access
-    
-    #retrieve a setting
-    var_name = var_name.to_s
-    
     if var = object(var_name)
       var.value
-    elsif @@defaults[var_name]
-      @@defaults[var_name]
+    elsif @@defaults[var_name.to_s]
+      @@defaults[var_name.to_s]
     else
       nil
     end</diff>
      <filename>lib/settings.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,29 +1,27 @@
 #!/usr/bin/env ruby
 require File.dirname(__FILE__) + '/../../../../test/test_helper'
 
-#module SettingsDefaults
-#  DEFAULTS = {:some_setting =&gt; 'foo'}
-#end
-
 class SettingsTest &lt; Test::Unit::TestCase
   
 	def setup
-		Settings.create(:var =&gt; 'test',           :value =&gt; 'foo'.to_yaml)
-		Settings.create(:var =&gt; 'secondary_test', :value =&gt; 'bar'.to_yaml)
+		Settings.create(:var =&gt; 'test',  :value =&gt; 'foo')
+		Settings.create(:var =&gt; 'test2', :value =&gt; 'bar')
 	end
 	
-#  def test_defaults
-#    assert_equal 'foo', Settings.some_setting
-#    assert_nil Settings.find(:first, :conditions =&gt; ['var = ?', 'some_setting'])
-#    
-#    Settings.some_setting = 'bar'
-#    assert_equal 'bar', Settings.some_setting
-#    assert_not_nil Settings.find(:first, :conditions =&gt; ['var = ?', 'some_setting'])
-#  end
+  def test_defaults
+    Settings.defaults[:foo] = 'default foo'
+    
+    assert_nil Settings.object(:foo)
+    assert_equal 'default foo', Settings.foo
+    
+    Settings.foo = 'bar'
+    assert_equal 'bar', Settings.foo
+    assert_not_nil Settings.object(:foo)
+  end
   
 	def test_get
 		assert_setting 'foo', :test
-		assert_setting 'bar', :secondary_test
+		assert_setting 'bar', :test2
 	end
 	
 	def test_update
@@ -35,9 +33,9 @@ class SettingsTest &lt; Test::Unit::TestCase
 	end
   
   def test_complex_serialization
-    object = [1, '2', {:three =&gt; true}]
-    Settings.object = object
-    assert_equal object, Settings.object
+    complex = [1, '2', {:three =&gt; true}]
+    Settings.complex = complex
+    assert_equal complex, Settings.complex
   end
   
   def test_serialization_of_float
@@ -51,7 +49,7 @@ class SettingsTest &lt; Test::Unit::TestCase
     def assert_setting(value, key)
       key = key.to_sym
       assert_equal value, eval(&quot;Settings.#{key}&quot;)
-      assert_equal value, Settings[key]
+      assert_equal value, Settings[key.to_sym]
       assert_equal value, Settings[key.to_s]
     end
     </diff>
      <filename>test/settings_test.rb</filename>
    </modified>
  </modified>
  <removed type="array">
    <removed>
      <filename>doc/classes/Settings.html</filename>
    </removed>
    <removed>
      <filename>doc/classes/Settings.src/M000001.html</filename>
    </removed>
    <removed>
      <filename>doc/classes/Settings.src/M000002.html</filename>
    </removed>
    <removed>
      <filename>doc/classes/Settings.src/M000003.html</filename>
    </removed>
    <removed>
      <filename>doc/classes/Settings.src/M000004.html</filename>
    </removed>
    <removed>
      <filename>doc/classes/Settings.src/M000005.html</filename>
    </removed>
    <removed>
      <filename>doc/classes/Settings.src/M000006.html</filename>
    </removed>
    <removed>
      <filename>doc/created.rid</filename>
    </removed>
    <removed>
      <filename>doc/files/README.html</filename>
    </removed>
    <removed>
      <filename>doc/files/lib/settings_rb.html</filename>
    </removed>
    <removed>
      <filename>doc/fr_class_index.html</filename>
    </removed>
    <removed>
      <filename>doc/fr_file_index.html</filename>
    </removed>
    <removed>
      <filename>doc/fr_method_index.html</filename>
    </removed>
    <removed>
      <filename>doc/index.html</filename>
    </removed>
    <removed>
      <filename>doc/rdoc-style.css</filename>
    </removed>
  </removed>
  <parents type="array">
    <parent>
      <id>cd5c446f9cff667d3f611d38d8b0dd11c01b5fa7</id>
    </parent>
  </parents>
  <author>
    <name>Alex Wayne</name>
    <email>alex@beautifulpixel.com</email>
  </author>
  <url>http://github.com/Squeegy/rails-settings/commit/c409585a39d89378f10c081d1b739c22384565ad</url>
  <id>c409585a39d89378f10c081d1b739c22384565ad</id>
  <committed-date>2008-04-12T15:03:08-07:00</committed-date>
  <authored-date>2008-04-12T15:03:08-07:00</authored-date>
  <message>Modernized code a bit, and got tests passing.  Implemented easier and simpler defaults.</message>
  <tree>94f2e6a225f9500b2fd30a067f2c6735c1e18e46</tree>
  <committer>
    <name>Alex Wayne</name>
    <email>alex@beautifulpixel.com</email>
  </committer>
</commit>
