<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -2,13 +2,13 @@ module HasDetails
   def self.included(base)
     base.extend(ClassMethods)
   end
-  
-  # HasDetails allows you to store a large amount of (optional) attributes for any model's instance in a 
-  # serialized column. It takes care of adding convenience methods to your model, and verifies that the 
+
+  # HasDetails allows you to store a large amount of (optional) attributes for any model's instance in a
+  # serialized column. It takes care of adding convenience methods to your model, and verifies that the
   # value being assigned is indeed (one of) the type(s) required for that attribute.
-  # 
+  #
   # Example:
-  # 
+  #
   #   class User &lt;&lt; ActiveRecord::Base
   #     has_details :column =&gt; :extended_attributes,
   #                 :firstname =&gt; String,
@@ -16,49 +16,50 @@ module HasDetails
   #                 :birthday =&gt; Date,
   #                 :gender =&gt; [:male, :female]
   #   end
-  #   
+  #
   #   john = User.find(1)
   #   john.birthday = 5.years.ago
   #   john.gender
   #   =&gt; :male
   module ClassMethods
-    
+
     # Configuration options are:
     #
     # * +column+ - Specifies the column name to use for storing the serialized attributes. This column will automatically be set to serialize in Rails. The default value is :details.
-    # 
+    #
     # The rest of the configuration options is the set of attributes that will be saved in the +column+. Valid formats are:
     # * +:field =&gt; ClassName+ (values assigned to +field+ must be of class +ClassName+)
     # * +:field =&gt; [:symbol, :othersymbol]+  (values assigned to +field+ must be included in the array given)
     def has_details(options = {})
       configuration = { :column =&gt; :details}
       configuration.update(options) if options.is_a?(Hash)
-      
+      column = configuration[:column]
+
       raise(ArgumentError, &quot;You must be supply at least one field in the configuration hash&quot;) unless configuration.keys.size &gt; 0
-#      raise(Exception, &quot;A #{configuration[:column]} column must be present in the database for this plugin.&quot;) unless columns.include?(:details)
-      
-      serialize configuration[:column], Hash
-      
+      raise(Exception, &quot;A #{column.inspect} column must be present in the database for this plugin.&quot;) unless column_names.include?(column.to_s)
+
+      serialize column, Hash
+
       configuration.each do |f,t|
+        unless f == :column
+          exception_code = t.is_a?(Array) ? &quot;raise \&quot;Assigned value must be one of #{t.inspect}\&quot; unless #{t.inspect}.include?(val)&quot; : \
+                                            &quot;raise \&quot;Assigned value must be a #{t.inspect}\&quot; unless val.is_a?(#{t.inspect})&quot;
+
+          class_eval &lt;&lt;-EOV
+            def #{f}
+              self.#{column.to_s} ||= {}
+              self.#{column.to_s}[:#{f}]
+            end
 
-        exception_code = t.is_a?(Array) ? &quot;raise \&quot;Assigned value must be one of #{t.inspect}\&quot; unless #{t.inspect}.include?(val)&quot; : \
-                                          &quot;raise \&quot;Assigned value must be a #{t.inspect}\&quot; unless val.is_a?(#{t.inspect})&quot;
-        
-        class_eval &lt;&lt;-EOV
-          def #{f}
-            self.details ||= {}
-            self.details[:#{f}]
-          end
-          
-          def #{f}=(val)
-            #{exception_code}
+            def #{f}=(val)
+              #{exception_code}
 
-            self.details ||= {}
-            self.details[:#{f}] = val
-          end
-        EOV
+              self.#{column.to_s} ||= {}
+              self.#{column.to_s}[:#{f}] = val
+            end
+          EOV
+        end
       end
-      
     end
   end
 </diff>
      <filename>lib/has_details.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>4922107a7980d0bbcbc94412a9e2cc13c5c7764a</id>
    </parent>
  </parents>
  <author>
    <name>Samuel Esposito</name>
    <email>samuel.esposito@gmail.com</email>
  </author>
  <url>http://github.com/marten/has_details/commit/33d423a5867793fea90a68766133f5edb233deae</url>
  <id>33d423a5867793fea90a68766133f5edb233deae</id>
  <committed-date>2008-11-24T02:48:12-08:00</committed-date>
  <authored-date>2008-11-24T02:48:12-08:00</authored-date>
  <message>Use column name option</message>
  <tree>e5d9ac3ab59d81f2421874c2b3b77c68ce1267fd</tree>
  <committer>
    <name>Samuel Esposito</name>
    <email>samuel.esposito@gmail.com</email>
  </committer>
</commit>
