<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -131,7 +131,12 @@ module MongoMapper
       
       def attributes=(attrs)
         attrs.each_pair do |key_name, value|
-          write_attribute(key_name, value) if writer?(key_name)
+          if writer?(key_name)
+            write_attribute(key_name, value)
+          else
+            writer_method =&quot;#{key_name}=&quot;
+            self.send(writer_method, value) if respond_to?(writer_method)
+          end
         end
       end
     </diff>
      <filename>lib/mongomapper/embedded_document.rb</filename>
    </modified>
    <modified>
      <diff>@@ -56,6 +56,19 @@ class EmbeddedDocumentTest &lt; Test::Unit::TestCase
         doc.attributes[:name].should == 'new value'
         doc.attributes[:foobar].should be(nil)
       end
+      
+      should &quot;not ignore keys that have methods defined&quot; do
+        @document.class_eval do
+          attr_writer :password
+          
+          def passwd
+            @password
+          end
+        end
+        
+        doc = @document.new(:name =&gt; 'foobar', :password =&gt; 'secret')
+        doc.passwd.should == 'secret'
+      end
 
       should &quot;typecast key values&quot; do
         doc = @document.new(:name =&gt; 1234, :age =&gt; '21')</diff>
      <filename>test/test_embedded_document.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>45ecabadca802dc3b6651d1d8c2493f89b45a804</id>
    </parent>
  </parents>
  <author>
    <name>John Nunemaker</name>
    <email>nunemaker@gmail.com</email>
  </author>
  <url>http://github.com/jnunemaker/mongomapper/commit/851e83000eb034e6398c61ef81fd030de8c5df60</url>
  <id>851e83000eb034e6398c61ef81fd030de8c5df60</id>
  <committed-date>2009-07-01T19:28:19-07:00</committed-date>
  <authored-date>2009-07-01T19:28:19-07:00</authored-date>
  <message>Attributes passed into attributes= now call writer methods if they exist. This is mostly for virtual attributes.</message>
  <tree>1a32523ee99a3f469b3117388f9ad2a80e3e6744</tree>
  <committer>
    <name>John Nunemaker</name>
    <email>nunemaker@gmail.com</email>
  </committer>
</commit>
