คุณสามารถทำได้ดังนี้:
class UsersController < ApplicationController
  ## Exception Handling
  class NotActivated < StandardError
  end
  rescue_from NotActivated, :with => :not_activated
  def not_activated(exception)
    flash[:notice] = "This user is not activated."
    Event.new_event "Exception: #{exception.message}", current_user, request.remote_ip
    redirect_to "/"
  end
  def show
      
      raise NotActivated unless @user.is_activated?
  end
end
สิ่งที่คุณกำลังทำอยู่นี้คือการสร้างคลาส "NotActivated" ที่จะใช้เป็น Exception เมื่อใช้การเพิ่มคุณสามารถโยน "NotActivated" เป็นข้อยกเว้นได้ Rescue_from เป็นวิธีการจับ Exception ด้วยวิธีการที่ระบุ (not_activated ในกรณีนี้) เป็นตัวอย่างที่ค่อนข้างยาว แต่ควรแสดงให้คุณเห็นว่ามันทำงานอย่างไร
ด้วยความปรารถนาดี
Fabian