<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>test/active_record_test.rb</filename>
    </added>
    <added>
      <filename>test/fixtures/manufacturers.yml</filename>
    </added>
    <added>
      <filename>test/fixtures/products.yml</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -97,12 +97,12 @@ By default `:allow_nil` is false for typed members but true for non-typed member
 	@data_source.password # nil
 
 NOTE: Make sure your call `define_attribute_methods` before calling `hattr_accessor` when you're using ActiveRecord and your `:attribute` is a 
-database field.
+database field. The call to `define_attribute_methods` must be after the `serialize` call so that `define_attribute_methods` knows about the 
+serialized field.
 
-	class CustomField &lt; ActiveRecord::Base
-	  define_attribute_methods
-	  
+	class CustomField &lt; ActiveRecord::Base	  
 	  serialize :configuration, Hash
+	  define_attribute_methods
 	  
 	  hattr_accessor :testing, :attribute =&gt; :configuration
 	end</diff>
      <filename>README.markdown</filename>
    </modified>
    <modified>
      <diff>@@ -4,12 +4,22 @@ module Huberry
   module HattrAccessor
     class MissingAttributeError &lt; StandardError; self; end
 
+    def hattr_defined?(attribute)
+      hattr_attributes.include?(attribute.to_sym)
+    end
+
+    def hattr_attributes
+      @hattr_attributes ||= []
+    end
+
     def hattr_accessor(*attrs)
       options = attrs.last.is_a?(Hash) ? attrs.pop : {}
 
       raise MissingAttributeError, 'Must specify the :attribute option with the name of an attribute which will store the hash' if options[:attribute].nil?
 
       attrs.each do |name|
+        hattr_attributes &lt;&lt; name
+
         # Defines a type casting getter method for each attribute
         #
         define_method name do
@@ -75,7 +85,31 @@ module Huberry
         EOF
       end
     end
+
+    module ActiveRecordExtensions
+      def self.included(base)
+        base.class_eval do
+
+          def read_attribute_with_hattr_accessor(attribute)
+            self.class.hattr_defined?(attribute) ? send(attribute) : read_attribute_without_hattr_accessor(attribute)
+          end
+          alias_method_chain :read_attribute, :hattr_accessor
+
+          def write_attribute_with_hattr_accessor(attribute, value)
+            self.class.hattr_defined?(attribute) ? send(&quot;#{attribute}=&quot;.to_sym, value) : write_attribute_without_hattr_accessor(attribute, value)
+          end
+          alias_method_chain :write_attribute, :hattr_accessor
+
+          def query_attribute_with_hattr_accessor(attribute)
+            self.class.hattr_defined?(attribute) ? send(&quot;#{attribute}?&quot;.to_sym) : query_attribute_without_hattr_accessor(attribute)
+          end
+          alias_method_chain :query_attribute, :hattr_accessor
+
+        end
+      end
+    end
   end
 end
 
-Class.send :include, Huberry::HattrAccessor
\ No newline at end of file
+Class.send :include, Huberry::HattrAccessor
+ActiveRecord::Base.send :include, Huberry::HattrAccessor::ActiveRecordExtensions if Object.const_defined?(:ActiveRecord)</diff>
      <filename>lib/hattr_accessor.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>8de14471eff8732bd54741236c8a7968a4ee1a56</id>
    </parent>
  </parents>
  <author>
    <name>Andrew White</name>
    <email>andyw@pixeltrix.co.uk</email>
  </author>
  <url>http://github.com/shuber/hattr_accessor/commit/9f9cda52569cf884671d6e0a4db7cb7dc2ca7a9f</url>
  <id>9f9cda52569cf884671d6e0a4db7cb7dc2ca7a9f</id>
  <committed-date>2009-02-28T08:07:06-08:00</committed-date>
  <authored-date>2009-02-28T08:07:06-08:00</authored-date>
  <message>Make hash attributes work with belong_to associations by chaining with the *_attribute methods</message>
  <tree>c4c5aed137373d52d7ef80089ceae8ad5f791b16</tree>
  <committer>
    <name>Andrew White</name>
    <email>andyw@pixeltrix.co.uk</email>
  </committer>
</commit>
