<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -12,8 +12,6 @@ In your model:
   class User &lt; ActiveRecord::Base
     has_digest :encrypted_password, :depends =&gt; :password
 
-    attr_accessor :password
-
     def authenticate(password)
       encrypted_password == digest(salt, password)
     end</diff>
      <filename>README.rdoc</filename>
    </modified>
    <modified>
      <diff>@@ -18,7 +18,6 @@ Rake::RDocTask.new(:rdoc) do |rdoc|
   rdoc.title    = 'HasDigest'
   rdoc.options &lt;&lt; '--line-numbers' &lt;&lt; '--inline-source'
   rdoc.rdoc_files.include('README.rdoc')
-  rdoc.rdoc_files.include('TODO.rdoc')
   rdoc.rdoc_files.include('lib/**/*.rb')
   rdoc.rdoc_files.include('shoulda_macros/**/*.rb')
 end</diff>
      <filename>Rakefile</filename>
    </modified>
    <modified>
      <diff>@@ -37,12 +37,20 @@ module HasDigest
     #   Setting any (non-synthetic) one of these attributes to +nil+ will
     #   effectively also set +attribute+ to +nil+.
     #
-    # === Magic Salting
+    # ===Magic Salting
     # If the model in question has a +salt+ attribute, its +salt+ be
     # automatically populated on create and automatically mixed into any
     # digests with dependencies on other attributes, saving you a little bit
     # of work when dealing with passwords.
     #
+    # ===Magic Synthetic Attributes
+    # If the model in question doesn't have a database column for one of your
+    # digest dependencies, an +attr_accessor+ for that synthetic dependency
+    # will be created automatically. For example, if you write &lt;tt&gt;has_digest
+    # :encrypted_password, :depends =&gt; :password&lt;/tt&gt; and don't have a
+    # +password+ column for your model, the +attr_accessor+ for +password+
+    # will be automatically created, saving you a redundant line of code.
+    #
     # ===Examples
     #   # token will be generated on create
     #   class Order &lt; ActiveRecord::Base
@@ -50,9 +58,9 @@ module HasDigest
     #   end
     #
     #   # encrypted_password will be generated on save whenever @password is not nil
+    #   # (Automatically calls attr_accessor :password.)
     #   class User &lt; ActiveRecord::Base
     #     has_digest :encrypted_password, :depends =&gt; :password
-    #     attr_accessor :password
     #   end
     #
     #   # remember_me_token will be generated on save whenever login or remember_me_until have changed.
@@ -62,9 +70,9 @@ module HasDigest
     #   end
     #
     #   # api_token will be blank until user.update_attributes(:generate_api_token =&gt; true).
+    #   # (Automatically calls attr_accessor :generate_api_token.)
     #   class User &lt; ActiveRecord::Base
     #     has_digest :api_token, :depends =&gt; :generate_api_token
-    #     attr_accessor :generate_api_token
     #   end
     def has_digest(attribute, options = {})
       digest_attribute = &quot;digest_#{attribute}&quot;.to_sym
@@ -79,20 +87,21 @@ module HasDigest
 
       before_save digest_attribute
 
-      define_method(digest_attribute) do
-        if options[:depends]
-          dependencies = []
-          dependencies &lt;&lt; :salt if self.class.column_names.include?('salt')
-          dependencies &lt;&lt; options[:depends]
-          dependencies.flatten!
-
-          values = dependencies.map { |dependency| self.send(dependency) }
+      if options[:depends]
+        dependencies = []
+        dependencies &lt;&lt; :salt if column_names.include?('salt')
+        dependencies &lt;&lt; options[:depends]
+        dependencies.flatten!
 
-          synthetic_dependencies = dependencies - attribute_names.map(&amp;:to_sym)
-          synthetic_dependencies.map! { |name| self.send(name) }
+        synthetic_dependencies = dependencies - column_names.map(&amp;:to_sym)
+        synthetic_dependencies.each { |name| attr_accessor name }
 
-          self[attribute] = digest(*values) if synthetic_dependencies.all?
-        else
+        define_method(digest_attribute) do
+          value = lambda { |name| send(name) }
+          self[attribute] = digest(*dependencies.map(&amp;value)) if synthetic_dependencies.map(&amp;value).all?
+        end
+      else
+        define_method(digest_attribute) do
           self[attribute] = digest if self.new_record?
         end
       end</diff>
      <filename>lib/has_digest.rb</filename>
    </modified>
    <modified>
      <diff>@@ -3,10 +3,18 @@ module HasDigest
     # Asserts that the necessary database columns exist to support
     # &lt;tt&gt;has_digest :name&lt;/tt&gt; and that the necessary callback methods have
     # been created.
-    def should_have_digest(name)
+    def should_have_digest(name, options = {})
       context &quot;Class #{model_class.name} with digest #{name}&quot; do
         should_have_db_column name, :type =&gt; :string # TODO :limit =&gt; 40
         should_have_instance_methods &quot;digest_#{name}&quot;
+
+        dependencies = options[:depends]
+        dependencies = [dependencies] unless dependencies.respond_to?(:each)
+        dependencies.compact!
+
+        dependencies.each do |dependency|
+          should_have_instance_methods &quot;#{dependency}&quot;, &quot;#{dependency}=&quot;
+        end
       end
     end
   end</diff>
      <filename>shoulda_macros/has_digest.rb</filename>
    </modified>
    <modified>
      <diff>@@ -45,7 +45,6 @@ class HasDigestTest &lt; Test::Unit::TestCase
   context 'Model with a single-attribute-based digest' do
     setup do
       @klass = model_with_attributes(:encrypted_password) do
-        attr_accessor :password
         has_digest :encrypted_password, :depends =&gt; :password
       end
     end</diff>
      <filename>test/has_digest_test.rb</filename>
    </modified>
  </modified>
  <removed type="array">
    <removed>
      <filename>TODO.rdoc</filename>
    </removed>
  </removed>
  <parents type="array">
    <parent>
      <id>4405ecbf7cfdb3177c45f4206938a5d158521df0</id>
    </parent>
  </parents>
  <author>
    <name>Matthew Todd</name>
    <email>matthew.todd@gmail.com</email>
  </author>
  <url>http://github.com/matthewtodd/has_digest/commit/695012b37c04771d536b5cb1c2475ebee119f5f6</url>
  <id>695012b37c04771d536b5cb1c2475ebee119f5f6</id>
  <committed-date>2008-11-07T06:55:39-08:00</committed-date>
  <authored-date>2008-11-07T06:55:39-08:00</authored-date>
  <message>Magic synthetic attributes.</message>
  <tree>6ad8ff1703ce1c565acf93540d756dac15e66749</tree>
  <committer>
    <name>Matthew Todd</name>
    <email>matthew.todd@gmail.com</email>
  </committer>
</commit>
