Hi! I want to auto-select the form method in my form creator to automate the creation of forms. Do you know any better way to do this? : (I want a better solution for this: form_method f, @resource, attribute ) The erb form: <% form_for(:resource, :url => resource_path, :html => { :method => :put }) do |f| %> <% resource_columns.each_with_index do |attribute, index| -%> <%= resource_titles[index] -%> <%= form_method f, @resource, attribute -%> <% end -%> <% end -%> The helper: # This Helper returns the apropiate form method # for the resource and attribute def form_method form, resource, attribute case resource.column_for_attribute(attribute).type when :string : form.text_field(attribute) when :text : form.text_area(attribute) when :integer : form.text_field(attribute) when :float : form.text_field(attribute) when :decimal : form.text_field(attribute) when :datetime : form.text_field(attribute) when :timestamp : form.text_field(attribute) when :time : form.text_field(attribute) when :date : form.text_field(attribute) when :binary : form.check_box(attribute) when :boolean : form.check_box(attribute) end end Thanks! emmanueloga.blogspot.com -- 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 -~----------~----~----~----~------~----~------~--~---