(Regarding the destroy action)
class UsersController < ApplicationController before_filter :authenticate, :only => [:index, :edit, :update, :destroy] before_filter :correct_user, :only => [:edit, :update] before_filter :admin_user, :only => :destroy . . . def destroy User.find(params[:id]).destroy flash[:success] = "User destroyed." redirect_to users_path end private . . . def admin_user redirect_to(root_path) unless current_user.admin? end end
So am I to take it that,
...assuming that current_user.admin? == false,
......when it gets to the second before_filter,
.........it will execute the redirect_to(root_path), and
.........after it does that it will just stop trying to get to the destroy action since there's something magic about the "redirect_to" which causes the execution path to forget that it wanted to get to :destroy?
Is this a correct interpretation? (btw, the tut is at http://ruby.railstut..._before_filter)