Tom,
My previous mistake probably gave you the wrong idea about what
the :object is doing. Like Fred says, :object is an option of the
render method. It tells the method which variable should be passed to
the partial. The variable can then be accessed in the partial with the
name of the partial itself ('edit' in your case) or just 'object'.
So:
render :partial => 'edit', :object => u
passes u to the partial, which is what you want as you're accessing an
instance of a User and you called it u. In the partial you can access
it with the variables object or edit, like so
<% form_for :user, edit, , :url => {:action => 'update'} do |f| %>
or
<% form_for :user, object, , :url => {:action => 'update'} do |f| %>
I don't like the first one because in this case it's not very good
semantics about what is being done in the form (you would be better
off renaming your partial 'user' so you would then be able to do
form_for user).
Like i mentioned before, I prefer to use the :locals option, it's more
explicit about what is being passed into the partial:
render :partial => 'edit', :locals => {:user => u}
and then you have a variable named 'user' that you can use in your
partial:
<%form_for :user, user, :url => {:action => 'update'} do |f| %>
So you have a couple of options here. Note that I like to explicitely
name all the arguments in the form_for method, makes it more readable.
What I'm saying here is to create a form for an object called
'user' (the first :user) which will be passed in the params hash, use
the object called 'object', 'edit' or 'user' (depending on the above
you choose) for the values of the fields to pre-fill and responding to
the submit button by calling the action 'update'.
Let me know if this works now.