Redirect to a back_url when deleting a rate also. #1919
This commit is contained in:
1 parent
a294ff0154
commit
dc8dd4abe4
2 files changed
+14
-1
No files matched your search
@@ -108,7 +108,13 @@ class RatesController < ApplicationController
|
|||||||
@rate.destroy
|
@rate.destroy
|
||||||
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html { redirect_to(rates_url(:user_id => @rate.user_id)) }
|
format.html {
|
||||||
|
if params[:back_url] && !params[:back_url].blank?
|
||||||
|
redirect_to(params[:back_url])
|
||||||
|
else
|
||||||
|
redirect_to(rates_url(:user_id => @rate.user_id))
|
||||||
|
end
|
||||||
|
}
|
||||||
format.xml { head :ok }
|
format.xml { head :ok }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -427,6 +427,13 @@ describe RatesController, "as an administrator" do
|
|||||||
response.should redirect_to(rates_url(:user_id => @user.id))
|
response.should redirect_to(rates_url(:user_id => @user.id))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it 'should redirect to the back_url if set' do
|
||||||
|
back_url = '/back_to_this_url'
|
||||||
|
Rate.stub!(:find).and_return(mock_rate(:destroy => true))
|
||||||
|
delete :destroy, :id => "1", :back_url => back_url
|
||||||
|
response.should redirect_to(back_url)
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
Reference in new issue
Block a user