use default CSS class within Custom FormBuilder

Michal Gabrukiewicz
Sat, 24 Nov 2007 17:09:01 -0000

i have created a custom formbuilder ...

class Std_Form_Builder < ActionView::Helpers::FormBuilder

  def self.create_field(method_name)
    define_method(method_name) do |label, *args|
      @template.content_tag(''div'',
        @template.content_tag(''div'',
          @template.content_tag(''label'', label.to_s.humanize +
'':'',
          :for => "#{@object_name}_#{label}"),
        :class => ''fLabel'') +
        @template.content_tag(''div'', super, :class =>
''fField''),
      :class => ''fRow'')
    end
  end

  field_helpers.each do |name|
    create_field(name)
  end

end

what i want to achieve is that all the field_helpers get populated with
a default css class. i have no clue ... it should still be possible to
override the css class if necessary.
thx for help
--
Posted via http://www.ruby-forum.com/.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---