<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>.DS_Store</filename>
    </added>
    <added>
      <filename>Rakefile</filename>
    </added>
    <added>
      <filename>init.rb</filename>
    </added>
    <added>
      <filename>lib/selection_options_for.rb</filename>
    </added>
    <added>
      <filename>tasks/selection_options_for_tasks.rake</filename>
    </added>
    <added>
      <filename>test/selection_options_for_ex_test.rb</filename>
    </added>
    <added>
      <filename>test/selection_options_for_test.rb</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -0,0 +1,96 @@
+SelectionOptionsFor
+===================
+
+# This code allows you to keep the display labels in the model 
+# when the DB holds only a 1 character flag.
+# and when the code requires symbolic references to the value to use in algorithms
+#
+# element 0 of the array passed in is always the logical symbol
+# If a 2-element Array is passed in, [key, label] and the first letter of label is the DB value
+# If a 3-element Array is passed in, [key, DB value, label] 
+# Any other type passed in throws an error
+#
+# Limitations: Don't use this if you will run reports directly against the DB 
+# In that case, the reports will not have access to the display labels
+#
+
+class Article &lt; ActiveRecord::Base
+
+        selection_options_for :file_type_option,
+           [:pdf,    'PDF'],
+           [:hmlt,   'HTML'],
+           [:msword, 'MS-Word']
+           [:text,   'X', 'Textfile']
+end
+
+adds the following class methods to Article
+
+* file_type_options
+  returns a array of 2-value arrays suitable to fill a select tag
+  The second example shows how to start the selection on a blank
+  &lt;%= select :article, :file_type_option, Article.file_type_options %&gt;
+  &lt;%= select :article, :file_type_option,  [['','']] + Article.file_type_options %&gt;
+
+	assert_equal  [&quot;MS-Word&quot;, &quot;PDF&quot;, &quot;HTML&quot;],   Article.file_type_option_hash.values
+  assert_equal &quot;['MS-Word', 'PDF', 'HTML']&quot;,  Article.file_type_option_js_list
+ 
+adds the following instance methods to Article
+
+* file_type_option_hash
+* file_type_option
+  returns the single character value as in the db
+
+* file_type_option_label
+  returns the current label value
+
+methods ending in '?' return boolean if the value is set
+methods ending in '!' set the value
+  
+* file_type_option_pdf?  
+* file_type_option_pdf! 
+
+* file_type_option_html?
+* file_type_option_html!
+
+* file_type_option_msword?
+* file_type_option_msword!
+
+example #1: Selection list
+
+  article = Article.new
+  article.file_type_option_pdf!
+  #assert_equal 'P',  article.file_type_option = 'P'
+  assert_equal 'P',   article.file_type_option
+  assert_equal true,  article.file_type_option_pdf?
+  assert_equal 'PDF', article.file_type_option_label
+  assert_equal [[&quot;MS-Word&quot;, &quot;M&quot;], [&quot;PDF&quot;, &quot;P&quot;], [&quot;HTML&quot;, &quot;H&quot;]], 
+               Article.file_type_options
+  assert_equal({&quot;M&quot;=&gt;&quot;MS-Word&quot;, &quot;P&quot;=&gt;&quot;PDF&quot;, &quot;H&quot;=&gt;&quot;HTML&quot;}, 
+               Article.file_type_option_hash) 
+
+By default the first letter of the label is used as the one character value 
+in the database field.  When there are duplicate first letters
+you can specify a different letter to be stored in the database
+In the example below 'R' is stored in the database when
+'Credit Card Account' is selected.
+
+Example #1: Selection list
+
+class Article &lt; ActiveRecord::Base
+ selection_options_for :payment_method_option,
+     [:basic,  'Basic'],
+     [:cash,   'Cash Account'],
+     [:cc, 'R','Credit Card Account']
+end
+
+ &lt;%=  select :article, :payment_method_option, Article.payment_method_options %&gt; 
+
+Example #2: Radio button labels
+
+  &lt;% Article.payment_method_option_hash.each do | key, value | %&gt;
+    &lt;%=  radio_button :article, :payment_method_option, key %&gt; &lt;%= value %&gt;&lt;br /&gt;
+  &lt;% end %&gt;
+
+Example #3 in a java_script list
+    payment_method_option_js_list
+</diff>
      <filename>README</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>f231a230401f98d8df94eda878bb1230c682741f</id>
    </parent>
  </parents>
  <author>
    <name>Mark W Windholtz</name>
    <email>mark@objectwind.com</email>
  </author>
  <url>http://github.com/mwindholtz/selection_options_for/commit/e1670ecd19522489f2dcd798f165b0a2ff232276</url>
  <id>e1670ecd19522489f2dcd798f165b0a2ff232276</id>
  <committed-date>2009-06-25T11:21:05-07:00</committed-date>
  <authored-date>2009-06-25T11:21:05-07:00</authored-date>
  <message>adding code from SVN rev 3</message>
  <tree>22ae6b431f88f944f3f1f92a772241e0435a41d3</tree>
  <committer>
    <name>Mark W Windholtz</name>
    <email>mark@objectwind.com</email>
  </committer>
</commit>
