Permalink
Browse files

Safer redirect

  • Loading branch information...
1 parent 5345abf commit c671f77c56585de8231fa9d8ec84f4e5736f6978 @rogercampos committed Mar 17, 2012
Showing with 4 additions and 4 deletions.
  1. +4 −4 app/controllers/entries_controller.rb
@@ -114,14 +114,14 @@ def destroy
unless @entry.destroy
flash[:alert] = @entry.errors.full_messages
end
- redirect_to entries_url(:year => @entry.cashed_at.year, :trimester => (@entry.cashed_at.month - 1) / 3 + 1)
+ redirect_to_back_or_default
end
def recalculation
authorize! :recalculation, @account
Entry.recalculate_for(@account)
- redirect_to request.env["HTTP_REFERER"] || entries_url, :notice => "Tota la linea ha estat recalculada"
+ redirect_to_back_or_default
end
def reorder
@@ -148,7 +148,7 @@ def verify
end
@account.entries.update_all({:verified => true}, conds)
- redirect_to request.env["HTTP_REFERER"] || entries_url
+ redirect_to_back_or_default
end
def unverify
@@ -163,7 +163,7 @@ def unverify
end
@account.entries.update_all({:verified => false}, conds )
- redirect_to request.env["HTTP_REFERER"] || entries_url
+ redirect_to_back_or_default
end

0 comments on commit c671f77

Please sign in to comment.