Improved error handling.

This commit is contained in:
Martin Edenhofer 2012-11-18 12:26:24 +01:00
parent 980e924de2
commit f2fd9b25c4
3 changed files with 8 additions and 3 deletions

3
.gitignore vendored
View file

@ -25,6 +25,9 @@ Gemfile.lock
# Ignore .swp files
.*.swp
# Ignore coverage stuff
/coverage/*
# Ignore local changes to schema.rb (e. g. through extentions)
db/schema.rb

View file

@ -1,3 +1,5 @@
require 'Cache'
class ApplicationModel < ActiveRecord::Base
self.abstract_class = true

View file

@ -24,12 +24,12 @@ class Ticket < ApplicationModel
def number_adapter=(adapter_name)
return @@number_adapter if @@number_adapter
case adapter_name
case adapter_name
when Symbol, String
require "ticket/number/#{adapter_name.to_s.downcase}"
require "ticket/number/#{adapter_name.to_s.downcase}"
@@number_adapter = Ticket::Number.const_get("#{adapter_name.to_s.capitalize}")
else
raise "Missing number_adapter #{adapter_name}"
raise "Missing number_adapter '#{adapter_name}'"
end
end