Sha256: 7bb851abd8bf3c4b1fc3a0e2cc2eb3be9993882bbfeae9d478e2c0b71e8a7dbc
Contents?: true
Size: 559 Bytes
Versions: 2
Compression:
Stored size: 559 Bytes
Contents
module SimpleCaptcha class SimpleCaptchaData < ::ActiveRecord::Base self.table_name = "simple_captcha_data" class << self def get_data(key) data = find_by_key(key) || new(:key => key) end def remove_data(key) where("#{connection.quote_column_name(:key)} = ?", key).delete_all clear_old_data(1.hour.ago) end def clear_old_data(time = 1.hour.ago) return unless Time === time where("#{connection.quote_column_name(:updated_at)} < ?", time).delete_all end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
glebtv-simple_captcha-0.8.1 | lib/simple_captcha/storage/active_record.rb |
glebtv-simple_captcha-0.8.0 | lib/simple_captcha/storage/active_record.rb |