Custom scaffolding problem

I have been trying to do my own edit form and it keeps saying I have a
missing template update.rhtml.

Here is my controller code:

def edit
@client = Client.find(params[:id])
end

def update
@client = Client.find(params[:id])

if @client.save
  flash[:notice] = 'Profile updated!'
else
  render :action => 'edit'
end

end

Here is my edit.rhtml code:

Editing <%= @client.username %>'s profile


Username: <%= @client.username %>

Password:

First Name:

Last Name:

Email:

IP: <%= @client.ip %>

Date Registered: <%= @client.dateIN %>

Why wont’ it accept my update?

Thanks,
-M

What does your update.rhtml file look like?

Steve M. wrote:

What does your update.rhtml file look like?

I shouldn’t have to make an update.rhtml file, I should only have to
create the edit.rhtml file. Its the same thing as new and create. You
only need to create the new.rhtml file but you don’t need to create the
create.rhtml file.

Your update does not redirect back to edit, thus you are getting the
error.
If you don’t tell the controller to render or redirect explicitly, it
will
render whatever template matches the name of the action.

def update
@client = Client.find(params[:id])

if @client.save
flash[:notice] = ‘Profile updated!’
else
render :action => ‘edit’
end
end

Should be

def update
@client = Client.find(params[:id])

if @client.save
flash[:notice] = ‘Profile updated!’
redirect_to :action=>“edit”, :id=>@client
else
render :action => ‘edit’
end
end