Permalink
Browse files

fixed a few bugs

  • Loading branch information...
nesquena committed Jun 2, 2008
1 parent 2c636d1 commit a625033129e090210fb8ac153b44333317c7a68d
Showing with 3 additions and 2 deletions.
  1. +2 −1 lib/semantic_fields_renderer.rb
  2. +1 −1 lib/semantic_form_builder.rb
@@ -50,7 +50,8 @@ def file_field_tag(name, options = {})
# ex: f.select_tag(:attribute, @option_values, :label => "example")
#
def select_tag(name, option_values, options={})
- label = options.delete(:label).gsub(' ', ' ')
+ label = options.delete(:label) || name.titleize
+ label.gsub!(' ', ' ')
content_tag("dt", content_tag("label" , "#{label}:", :for => name )) + "\n" +
content_tag("dd", @super.select_tag(name, option_values, options))
end
@@ -221,7 +221,7 @@ def self.create_field_element(input_type_name)
# returns unchanged in any other case.
#
def object_name(id=false)
- return @object_name unless @object
+ return @object_name if @object.nil? or @object.new_record?
replace_string = id ? "_#{@object.id}" : "[#{@object.id}]"
@object_name.to_s.include?("[]") ? @object_name.gsub(/\[\]/, replace_string) : @object_name

0 comments on commit a625033

Please sign in to comment.