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
127.0.0.1 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
end
def update
@account = current_account
if @account.update_attributes(params[:account])
flash[:notice] = t(''flash.saved'')
redirect_to :action => :show
else
render :action => :edit
end
end
specify the controller name in your render and redirect. Is it still giving the same error? -- Posted via http://www.ruby-forum.com/.
Yep, I tried that and I''m still getting the same error. On Aug 14, 4:39 am, Rails List <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> specify the controller name in your render and redirect. Is it still > giving the same error? > -- > Posted viahttp://www.ruby-forum.com/.
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!
On Aug 14, 10:39 am, elioncho
<elion...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:> Yep, I tried that and I''m still getting the same error.
>
> On Aug 14, 4:39 am, Rails List
<rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>
> wrote:
>
> > specify the controller name in your render and redirect. Is it still
> > giving the same error?
> > --
> > Posted viahttp://www.ruby-forum.com/.