Hello,
Here is the situation:
I have a List action that lists items for me (scaffold generated), now I need to the destroy method to be ajaxed, I wrote the following:
OK, everything's going fine except that destroy method must -of course- redirect the page to the list action:Code:<%=link_to_remote ('Destroy', :update => "main", :url => {:action => 'destroy', :id => @category}, :confirm => 'Are you sure?', :post => true, :loading => "document.getElementById('loading').style.display='inline'", :loaded => "document.getElementById('loading').style.display='none'")%>
Now the problem is that layout is regenerated for the list action after the redirect so I get a doubled layout with the page. I may not except the list method from the layout because it will not show the page layout when listing items.Code:def destroy Category.find(params[:id]).destroy redirect_to :action => 'list'
I have searched the rails documentation and found this:
render :action => "list", :layout => false
But this didn't work, it caused an error.
Do you suggest some other solution?




Bookmarks