Two things:
1. If you are destroying something, and using Effect.Fade, you don''t
need
the :update param in your call. Just let javascript fade it out.
2. I''m guessing that your app is getting upset because you are trying
to
return an entire page.
try this:
def destroy
Image.find(params[:id]).destroy
end
On 7/13/05, Kieran Johnson
<endlessinfinity-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:>
> I''ve been following along with rails and ajax and have been
getting on
> ok, until now.
> I have a list of items, each has a link_to_remote call to a destroy
> action.
> My problem is that when this is called it renders the entire page in
> the div that should have been updated. So I took out my call to
> redirect_to (:action => "new"), but now it complains that the
template
> for the action ''destroy'' does not exist.
> I''ve tried render(:layout => false) both with and without the
redirect
> and this causes errors or makes no difference.
>
> Could anybody enlighten me to what must be quite simple.
>
> My ajax call:
>
> <%= link_to_remote "Destroy",
> :update => ''list'',
> :complete => "new Effect.Fade(''#{element.id
<http://element.id>}'')",
> :url => {:action => "destroy", :id => image.id
<http://image.id>} %>
>
>
> My destroy action:
>
> def destroy
> Image.find(params[:id]).destroy
> redirect_to (:action => ''new'')
> end
>
> Many Thanks
>
> Kieran
> _______________________________________________
> Rails mailing list
> Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
> http://lists.rubyonrails.org/mailman/listinfo/rails
>
--
Nathan Colgate Clark
Web Developer, Jews for Jesus
http://www.jewsforjesus.org
_______________________________________________
Rails mailing list
Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
http://lists.rubyonrails.org/mailman/listinfo/rails