Sha256: d0ea75c8ec33ac6de6acc461a2956656272d0366c173ee6390ac6bfaaa44cab7
Contents?: true
Size: 918 Bytes
Versions: 10
Compression:
Stored size: 918 Bytes
Contents
#Extend this module on ActiveRecord to access global functions class ExtensionNotSupported < Exception; end; module ActiveRecord module Extensions module SupportMethods#:nodoc: def supports_extension(name) class_eval(<<-EOS, __FILE__, __LINE__) def self.supports_#{name}?#:nodoc: connection.supports_#{name}? rescue NoMethodError false end def supports_#{name}?#:nodoc: self.class.supports_#{name}? end def self.supports_#{name}!#:nodoc: supports_#{name}? or raise ExtensionNotSupported.new("#{name} extension is not supported. Please require the adapter file.") end def supports_#{name}!#:nodoc: self.class.supports_#{name}! end EOS end end end end ActiveRecord::Base.send :extend, ActiveRecord::Extensions::SupportMethods
Version data entries
10 entries across 10 versions & 3 rubygems