I want to redirect to a resource index when a new item is created
Here is a piece of the controller:
def create
@asset = Asset.new(params[:asset])
@assets = Asset.all
respond_to do |format|
if @asset.save
format.html { render :action => 'index' } ##########
format.xml { render :xml => @asset, :status => :created, :location => @asset }
else
format.html { render :action => "new" }
format.xml { render :xml => @asset.errors, :status => :unprocessable_entity }
end
end
end
The line i'm interested is marked ##########
i've tried
format.html { redirect_to(assets_url) }
and some other stuff
It redirects to the right place and creates the item fine, the problem is that i cant get it to not POST
. I need to get it to GET
because otherwise it does some horribly screwy things to my view.