Sha256: f10da3fcb8d992763ff4e5659797b6281bdf18612f74652e001bdaaa5e86eab2
Contents?: true
Size: 683 Bytes
Versions: 12
Compression:
Stored size: 683 Bytes
Contents
module SimpleCaptcha class SimpleCaptchaData include Mongoid::Document include Mongoid::Timestamps store_in collection: "simple_captcha_data" field :key, :type => String field :value, :type => String class << self def get_data(key) SimpleCaptchaData.where(:key => key).first || new(:key => key) end def remove_data(key) SimpleCaptchaData.where(:key => key).first.delete clear_old_data(1.hour.ago) end def clear_old_data(time = 1.hour.ago) return unless Time === time SimpleCaptchaData.where(:updated_at.lt => time.utc).delete_all end end end end
Version data entries
12 entries across 12 versions & 1 rubygems