बनाने का तरीका इस प्रकाररेल 3 कस्टम अपवाद
lib/exceptions.rb
module Exceptions
class MemberOverFlow < StandardError
end
rescue_from MemberOverFlow do |exception|
redirect_to root_url, :alert => exception.message
end
end
मैं इस तरह अपवाद को बढ़ाने के लिए उपयोग करते हैं मैं कुछ कस्टम अपवाद बनाने रहा हूँ।
raise Exception::MemberOverFlow"member count overflow"
यह निम्न त्रुटि
NoMethodError in MembersController#create
undefined method `MemberOverFlow' for Exception:Class
देने
किसी को भी मुझे बता सकते हैं कि समस्या क्या
धन्यवाद
आपका मॉड्यूल नाम अपवाद है और आप 'अपवाद ::' का उपयोग कर रहे हैं। क्या यह एक टाइपो है? –