Created
July 29, 2009 13:31
-
-
Save simonrobson/158168 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- Note: this depends on this patch being applied: | |
http://github.com/simonrobson/spree/commit/5d94572bf5ba8fe8198a21dc1253845603fb3c9d --> | |
<p> | |
<% attribute = field[:name].gsub(" ", "_").downcase %> | |
<%= f.label attribute, field[:name] %> | |
<% if f.object && f.object.column_for_attribute(attribute).type == :boolean %> | |
<%= f.check_box attribute %> | |
<% else %> | |
<br /> | |
<% val = f.object.send(attribute.to_sym) rescue nil | |
formatted_value = (val.nil? || !field.key?(:format)) ? val : val % field[:format] %> | |
<%= f.text_field attribute, :value => formatted_value %> | |
<% end %> | |
<%= f.error_message_on attribute %> | |
</p> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment