lib/phony_rails.rb in phony_rails-0.14.4 vs lib/phony_rails.rb in phony_rails-0.14.5
- old
+ new
@@ -104,11 +104,11 @@
Phony.plausible? number, cc: country_number
rescue
false
end
- COMMON_EXTENSIONS = /[ ]*(ext|ex|x|xt|#|:)+[^0-9]*\(*([-0-9]{1,})\)*#?$/i
+ COMMON_EXTENSIONS = /[ ]*(ext|ex|x|xt|#|:)+[^0-9]*\(?([-0-9]{1,})\)?#?$/i
def self.extract_extension(number_and_ext)
return [nil, nil] if number_and_ext.nil?
# :nocov:
if subbed = number_and_ext.sub(COMMON_EXTENSIONS, '')
@@ -197,10 +197,10 @@
end
# check whether it is ActiveRecord or Mongoid being used
ActiveRecord::Base.send :include, PhonyRails::Extension if defined?(ActiveRecord)
-ActiveModel::Model.send :include, PhonyRails::Extension if defined?(ActiveModel)
+ActiveModel::Model.send :include, PhonyRails::Extension if defined?(ActiveModel::Model)
if defined?(Mongoid)
module Mongoid::Phony
extend ActiveSupport::Concern
include PhonyRails::Extension