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

**URL:** <https://www.ruby-forum.com/t/passing-strings-from-model-to-a-form-to-edit-the-information/144374>\
**Category:** Rails\
**Created:** [July 29, 2008, 5:58am UTC](https://www.ruby-forum.com/t/passing-strings-from-model-to-a-form-to-edit-the-information/144374 "2008-07-29T05:58:08Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![lz-coelho](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/8c91f0/32.png) [@lz-coelho](https://www.ruby-forum.com/u/lz-coelho)\
**Post date:** [July 29, 2008, 5:58am UTC](https://www.ruby-forum.com/t/passing-strings-from-model-to-a-form-to-edit-the-information/144374/1 "2008-07-29T05:58:08Z")

</div>

Yeah,

I’m trying to develop a “User Profile” and want to show some forms with  
the  
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 =\> @u.name  
\<% end %\>

But what’s object really does?

–  
Regards,

Luiz Vitor Martinez C.  
cel.: (11) 8187-8662  
blog: [rubz.org](http://rubz.org)  
engineer student at maua.br

---

<div class="post-metadata">

**Author:** ![lz-coelho](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/8c91f0/32.png) [@lz-coelho](https://www.ruby-forum.com/u/lz-coelho)\
**Post date:** [July 29, 2008, 11:03am UTC](https://www.ruby-forum.com/t/passing-strings-from-model-to-a-form-to-edit-the-information/144374/2 "2008-07-29T11:03:13Z")

</div>

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

Then:  
\<% 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 @user.name
