Forms filled at initialization?

Hi,

I've created some a form for filling some signup information for an user.

Now i need to reuse the same code to create an 'edit information' form, what means that the forms needs to be initialized with the values stored in the database.

I suppose there is some automatic mean of doing such, but can't find no information on this topic.

Thanks in advance, hugo

There are 2 basic types of form helpers: the form helpers and the form tag helpers. The form tag helpers are basic wrappers around input tags.

<%= text_field_tag :search, params[:search] %>

Form helpers work with objects:

<%= text_field 'user', 'name' %>

This will prefill with the value from @user.name, and set a form name of "user[name]". form_for gives you a nice shortcut for this:

<% form_for :user do |form| -%>   <%= form.text_field :name %>   <%= form.text_field :email %> <% end -%>