Passing strings from model to a form, to edit the information


I’m trying to develop a “User Profile” and want to show some forms with
content stored in database. I search in documentation but i don’t find
anything useful. I try

at controller:
@u = User.find(:last)

at view:

<% form_for :user |f| do %>
f.text_field :name, :object =>
<% end %>

But what’s object really does?


Luiz Vitor Martinez C.
cel.: (11) 8187-8662
engineer student at

Don’t know, what you’re doing here. You should use:
@user = User.find(:last)

<% form_for :user |f| do %>
f.text_field :name
<% end %>

Is all you need. If you use form_for :user, then
Rails expects the data to be in object @user and
if you use f.text_field instead of the simple text_field,
then Rails knows already, that the object to be used
is that bound to the form (@user in htis case) and
knows, that :name is