Sha256: d131bd1fce48d07eb875765876815292b0aaf23379bccf0173b7edb8140d593b
Contents?: true
Size: 401 Bytes
Versions: 7
Compression:
Stored size: 401 Bytes
Contents
module SingletonHelper def singleton name, *options @@singletons ||= {} begin @@singletons[name].reload rescue NoMethodError, ActiveRecord::RecordInvalid, ActiveRecord::RecordNotFound => e # puts "singleton error (#{e.class}): " << e.message @@singletons[name] ||= create name, *options end end def reset_singletons! @@singletons = {} end end
Version data entries
7 entries across 4 versions & 1 rubygems