# Custom scaffolding problem

**URL:** <https://www.ruby-forum.com/t/custom-scaffolding-problem/109766>\
**Category:** Rails\
**Created:** [July 18, 2007, 8:38pm UTC](https://www.ruby-forum.com/t/custom-scaffolding-problem/109766 "2007-07-18T20:38:20Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![turnkeytraders](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/ba8739/32.png) [@turnkeytraders](https://www.ruby-forum.com/u/turnkeytraders)\
**Post date:** [July 18, 2007, 8:38pm UTC](https://www.ruby-forum.com/t/custom-scaffolding-problem/109766/1 "2007-07-18T20:38:20Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![turnkeytraders](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/ba8739/32.png) [@turnkeytraders](https://www.ruby-forum.com/u/turnkeytraders)\
**Post date:** [July 18, 2007, 11:24pm UTC](https://www.ruby-forum.com/t/custom-scaffolding-problem/109766/2 "2007-07-18T23:24:21Z")

</div>

What does your update.rhtml file look like?

---

<div class="post-metadata">

**Author:** ![turnkeytraders](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/ba8739/32.png) [@turnkeytraders](https://www.ruby-forum.com/u/turnkeytraders)\
**Post date:** [July 19, 2007, 7:12pm UTC](https://www.ruby-forum.com/t/custom-scaffolding-problem/109766/3 "2007-07-19T19:12:16Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![turnkeytraders](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/ba8739/32.png) [@turnkeytraders](https://www.ruby-forum.com/u/turnkeytraders)\
**Post date:** [July 19, 2007, 7:22pm UTC](https://www.ruby-forum.com/t/custom-scaffolding-problem/109766/4 "2007-07-19T19:22:28Z")

</div>

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
