Template is missing

Ok I’m getting this weird error whenever the update action fails to
update. My code is below (its pretty straightforward). When the update
is successful it works well, the problem is when it fails. I get a,

Template is missing
Missing template accounts/edit.erb in view path app/views

This doesn’t makes any sense as the edit view opens when I want to
edit my account in the first place. I have noticed this on my console
which seems weird and I’m pretty sure has to do with the problem:

Processing AccountsController#update to #account:0xb70a69ac (for at 2009-08-14 04:04:28) [PUT]
Parameters: {“format”=>“#account:0xb70a69ac”… —> NOTICE THE
‘update to’ , the account:0x...ac and the format parameter.

And the url changes to this:

http://antonio.app.com:3000/account.%23 … 70a69ac%3E

Any ideas?

def edit
@account = current_account

def update
@account = current_account
if @account.update_attributes(params[:account])
flash[:notice] = t(‘flash.saved’)
redirect_to :action => :show
render :action => :edit

Yep, I tried that and I’m still getting the same error.

On Aug 14, 4:39 am, Rails L. [email protected]

specify the controller name in your render and redirect. Is it still
giving the same error?

Fixed it. I was using a form_for like this:

<% form_for @account do |f| %>

and this was generating the following in html:

<form action="/account.%23%3Caccount:0xb71052a4%3E" class="edit_account"...

Maybe because it is a resource?

I changed it to:

<% form_for :account, @account, :url => { :action => ‘update’ }, :html
=> { :method => :put } do |f| %>

Now it works!