app/controllers/application_controller.rb
# Prevent CSRF attacks by raising an exception.
# For APIs, you may want to use :null_session instead.
Prevent CSRF attacks by raising an exception.
For APIs, you may want to use :null_session instead.
Prevent CSRF attacks by raising an exception . For APIs you may want to use : null_session instead .
def require_user_unit(unit)
    unless @current_user.in_unit?(unit)
      @unit = unit
      flash[:error] = "You don't belong to the #{@unit.name} unit, so you can't view this item."
      redirect_to root_path
    end
  end
def require_user_unit ( unit ) unless @current_user . in_unit? ( unit ) @unit = unit flash [ :error ] = "You don't belong to the #{@unit.name} unit, so you can't view this item." redirect_to root_path end end
Prevent CSRF attacks by raising an exception.
Prevent CSRF attacks by raising an exception .
# return render :template => "exceptions/wrong_unit", :status => :unauthorized
unit