<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>merb-helpers/spec/fixture/app/views/bound_select_specs/selected.html.erb</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -164,7 +164,7 @@ module Merb::Helpers::Form::Builder
     def update_bound_select(method, attrs)
       attrs[:value_method] ||= method
       attrs[:text_method] ||= attrs[:value_method] || :to_s
-      attrs[:selected] ||= control_value(attrs[:value_method])
+      attrs[:selected] ||= control_value(method)
     end
 
     def update_unbound_controls(attrs, type)</diff>
      <filename>merb-helpers/lib/merb-helpers/form/builder.rb</filename>
    </modified>
    <modified>
      <diff>@@ -979,6 +979,19 @@ describe &quot;bound_select&quot; do
     form.should have_selector(&quot;label[for=fake_model_foo]:contains('LABEL')&quot;)
   end
 
+  it &quot;should render a select tag with correct field selected&quot; do
+    a = FakeModel3.new; a.bar = &quot;A&quot;; a.foo = 4
+    b = FakeModel3.new; b.bar = &quot;B&quot;; b.foo = 2
+    c = FakeModel3.new; c.bar = &quot;C&quot;; c.foo = 7
+
+    @c.instance_variable_set(:@collection, [a,b,c])
+
+    r = @c.render :selected
+    r.should_not have_selector(&quot;select[id=fake_model_bar] option[selected]:contains('A')&quot;)
+    r.should_not have_selector(&quot;select[id=fake_model_bar] option[selected]:contains('B')&quot;)
+    r.should have_selector(&quot;select[id=fake_model_bar] option[selected]:contains('C')&quot;)
+  end
+
   # Not sure how this makes any sense
   # ---------------------------------
   #</diff>
      <filename>merb-helpers/spec/merb_helpers_form_spec.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>db4357f597bc903b5e2bdb5b5b9640ce31c3d5d6</id>
    </parent>
  </parents>
  <author>
    <name>Tymon Tobolski</name>
    <email>i@teamon.eu</email>
  </author>
  <url>http://github.com/wycats/merb/commit/b26df5a35bbd373cefabf9313b8f5ec3f3fc2464</url>
  <id>b26df5a35bbd373cefabf9313b8f5ec3f3fc2464</id>
  <committed-date>2009-10-26T16:31:40-07:00</committed-date>
  <authored-date>2009-10-26T14:37:22-07:00</authored-date>
  <message>[merb-helpers] Select the correct field in select tags</message>
  <tree>605423c9ff0bb9a1b33852561fd8cfa8a41825b2</tree>
  <committer>
    <name>snusnu</name>
    <email>gamsnjaga@gmail.com</email>
  </committer>
</commit>
