Sha256: cd6c183a7934b5c23b6a3c6f0532cff994dd75f12418e6a0c57be65692253ad8
Contents?: true
Size: 565 Bytes
Versions: 18
Compression:
Stored size: 565 Bytes
Contents
module SimpleCaptcha class SimpleCaptchaData include Mongoid::Document include Mongoid::Timestamps field :key, type: String field :value, type: String class << self def get_data(key) data = where(:key => key).first || new(:key => key) end def remove_data(key) where(:key => key).delete_all clear_old_data(1.hour.ago) end def clear_old_data(time = 1.hour.ago) return unless Time === time where(:updated_at.lte => time).delete_all end end end end
Version data entries
18 entries across 18 versions & 6 rubygems