<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -30,12 +30,13 @@ class Symbol
     Thread.current[:view_template].hidden_field(self, *args)
   end
   
-  # See Mack::ViewHelpers::FormHelpers image_submit for more information
-  def image_submit(*args)
-    Thread.current[:view_template].image_submit(self, *args)
-  end
-  
   # See Mack::ViewHelpers::FormHelpers label_tag for more information
+  # 
+  # Examples:
+  #   @user = User.new
+  #   &lt;%= :user.label_tag :email %&gt; # =&gt; &lt;label for=&quot;user_email&quot;&gt;Email&lt;/label&gt;
+  #   &lt;%= :i_dont_exist.label_tag %&gt; # =&gt; &lt;label for=&quot;i_dont_exist&quot;&gt;I don't exist&lt;/label&gt;
+  #   &lt;%= :i_dont_exist.label_tag :value =&gt; &quot;Hello&quot; %&gt; # =&gt; &lt;label for=&quot;i_dont_exist&quot;&gt;Hello&lt;/label&gt;
   def label_tag(*args)
     Thread.current[:view_template].label(self, *args)
   end
@@ -51,6 +52,11 @@ class Symbol
   end
   
   # See Mack::ViewHelpers::FormHelpers radio_button for more information
+  # 
+  # Examples:
+  #   @user = User.new(:level =&gt; 1)
+  #   &lt;%= :user.radio_button :level %&gt; # =&gt; &lt;input checked=&quot;checked&quot; id=&quot;user_level&quot; name=&quot;user[level]&quot; type=&quot;radio&quot; /&gt;
+  #   &lt;%= :i_dont_exist.radio_button %&gt; # =&gt; &lt;input id=&quot;i_dont_exist&quot; name=&quot;i_dont_exist&quot; type=&quot;radio&quot; /&gt;
   def radio_button(*args)
     Thread.current[:view_template].radio_button(self, *args)
   end</diff>
      <filename>lib/mack/core_extensions/symbol.rb</filename>
    </modified>
    <modified>
      <diff>@@ -67,15 +67,6 @@ module Mack
         content_tag(:label, fe.options, content)
       end
 
-      def radio_button(name, *args)
-        build_form_element(name, {:type =&gt; :radio}, *args) do |var, fe, options|
-          if options[:value]
-            options.merge!(:checked =&gt; &quot;checked&quot;)
-          end
-          options.delete(:value)
-        end
-      end
-
       def select(name, *args)
         var = instance_variable_get(&quot;@#{name}&quot;)
         fe = FormElement.new(*args)
@@ -140,14 +131,26 @@ module Mack
         build_form_element(name, {:type =&gt; :password}, *args)
       end
       
+      def radio_button(name, *args)
+        build_form_element(name, {:type =&gt; :radio, :value =&gt; &quot;&quot;}, *args) do |var, fe, options|
+          if fe.options[:value]
+            if fe.options[:value] == options[:value]
+              options.merge!(:checked =&gt; &quot;checked&quot;)
+            end
+          elsif options[:value]
+            options.merge!(:checked =&gt; &quot;checked&quot;)
+          end
+        end
+      end
+      
       private
       def build_form_element(name, options, *original_args)
         var = instance_variable_get(&quot;@#{name}&quot;)
+        fe = FormElement.new(*original_args)
         options = {:name =&gt; name, :id =&gt; name}.merge(options)
         if var.nil?
-          return non_content_tag(:input, options)
+          return non_content_tag(:input, options.merge(fe.options))
         else
-          fe = FormElement.new(*original_args)
           unless fe.calling_method == :to_s
             options.merge!(:name =&gt; &quot;#{name}[#{fe.calling_method}]&quot;, :id =&gt; &quot;#{name}_#{fe.calling_method}&quot;)
           end
@@ -180,6 +183,9 @@ module Mack
           else
             raise ArgumentError.new(&quot;You must provide either a Symbol, a String, a Hash, or a combination thereof.&quot;)
           end
+          if self.options[:checked]
+            self.options[:checked] = :checked
+          end
         end
 
       end</diff>
      <filename>lib/mack/view_helpers/form_helpers.rb</filename>
    </modified>
    <modified>
      <diff>@@ -151,25 +151,19 @@ describe Mack::ViewHelpers::FormHelpers do
   describe &quot;radio_button&quot; do
     
     it &quot;should create a nested radio_button for a model&quot; do
-      radio_button(:cop, :tos).should == %{&lt;input id=&quot;cop_tos&quot; name=&quot;cop[tos]&quot; type=&quot;radio&quot; /&gt;}
+      radio_button(:cop, :level).should == %{&lt;input checked=&quot;checked&quot; id=&quot;cop_level&quot; name=&quot;cop[level]&quot; type=&quot;radio&quot; value=&quot;1&quot; /&gt;}
+      radio_button(:cop, :level, :value =&gt; &quot;twoa&quot;).should == %{&lt;input id=&quot;cop_level&quot; name=&quot;cop[level]&quot; type=&quot;radio&quot; value=&quot;twoa&quot; /&gt;}
     end
     
     it &quot;should create a non-nested radio_button for a simple object&quot; do
-      radio_button(:simple).should == %{&lt;input checked=&quot;checked&quot; id=&quot;simple&quot; name=&quot;simple&quot; type=&quot;radio&quot; /&gt;}
+      radio_button(:simple).should == %{&lt;input checked=&quot;checked&quot; id=&quot;simple&quot; name=&quot;simple&quot; type=&quot;radio&quot; value=&quot;hi&quot; /&gt;}
+      radio_button(:simple, :value =&gt; &quot;twob&quot;).should == %{&lt;input id=&quot;simple&quot; name=&quot;simple&quot; type=&quot;radio&quot; value=&quot;twob&quot; /&gt;}
     end
     
     it &quot;should create a non-nested radio_button for just a symbol&quot; do
-      radio_button(:unknown).should == %{&lt;input id=&quot;unknown&quot; name=&quot;unknown&quot; type=&quot;radio&quot; /&gt;}
-    end
-    
-    it &quot;should be checked if the value is true&quot; do
-      @cop.tos = true
-      radio_button(:cop, :tos).should == %{&lt;input checked=&quot;checked&quot; id=&quot;cop_tos&quot; name=&quot;cop[tos]&quot; type=&quot;radio&quot; /&gt;}
-    end
-    
-    it &quot;should be unchecked if the value is false&quot; do
-      @cop.tos = false
-      radio_button(:cop, :tos).should == %{&lt;input id=&quot;cop_tos&quot; name=&quot;cop[tos]&quot; type=&quot;radio&quot; /&gt;}
+      radio_button(:unknown).should == %{&lt;input id=&quot;unknown&quot; name=&quot;unknown&quot; type=&quot;radio&quot; value=&quot;&quot; /&gt;}
+      radio_button(:unknown, :value =&gt; &quot;twoc&quot;).should == %{&lt;input id=&quot;unknown&quot; name=&quot;unknown&quot; type=&quot;radio&quot; value=&quot;twoc&quot; /&gt;}
+      radio_button(:unknown, :value =&gt; &quot;twod&quot;, :checked =&gt; true).should == %{&lt;input checked=&quot;checked&quot; id=&quot;unknown&quot; name=&quot;unknown&quot; type=&quot;radio&quot; value=&quot;twod&quot; /&gt;}
     end
     
   end</diff>
      <filename>test/unit/view_helpers/form_helpers_spec.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>eec9f0b42187b957405790fc1780600de062f0c7</id>
    </parent>
  </parents>
  <author>
    <name>Mark Bates</name>
    <email>mark@markbates.com</email>
  </author>
  <url>http://github.com/markbates/mack/commit/d83e931e8bd246ca664547f181fdc30c516d56c4</url>
  <id>d83e931e8bd246ca664547f181fdc30c516d56c4</id>
  <committed-date>2008-08-14T13:08:07-07:00</committed-date>
  <authored-date>2008-08-14T13:08:07-07:00</authored-date>
  <message>Actually made radio_button work right. :) [#19]</message>
  <tree>f18a9b009e5ac199e8b98a59bf904ec1deb20cc6</tree>
  <committer>
    <name>Mark Bates</name>
    <email>mark@markbates.com</email>
  </committer>
</commit>
