From 21d1c0e787573613154ad942af648df03624730c Mon Sep 17 00:00:00 2001 From: Jason Lee Date: Wed, 9 Nov 2016 15:24:31 +0800 Subject: [PATCH] Fix #35 just give a warning message if not setup a right cache_store, only raise on :null_store --- CHANGELOG.md | 5 +++++ Gemfile.lock | 2 +- lib/rucaptcha/engine.rb | 9 +++++++-- lib/rucaptcha/version.rb | 2 +- 4 files changed, 14 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 61204d6..d874043 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +1.1.3 +----- + +- Fix #35 just give a warning message if not setup a right cache_store, only raise on :null_store. + 1.1.2 ----- diff --git a/Gemfile.lock b/Gemfile.lock index 2d6d29f..aa3e937 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - rucaptcha (1.1.2) + rucaptcha (1.1.3) railties (>= 3.2) GEM diff --git a/lib/rucaptcha/engine.rb b/lib/rucaptcha/engine.rb index f3a994e..61b62f2 100644 --- a/lib/rucaptcha/engine.rb +++ b/lib/rucaptcha/engine.rb @@ -11,16 +11,21 @@ module RuCaptcha cache_store = RuCaptcha.config.cache_store store_name = cache_store.is_a?(Array) ? cache_store.first : cache_store if [:memory_store, :null_store, :file_store].include?(store_name) - raise " + msg = " RuCaptcha's cache_store requirements are stored across processes and machines, such as :mem_cache_store, :redis_store, or other distributed storage. But your current set is :#{store_name}. Please make config file `config/initializes/rucaptcha.rb` to setup `cache_store`. - More infomation please read GitHub rucaptcha README file. + More infomation please read GitHub RuCaptcha README file. " + if store_name == :null_store + raise msg + else + Rails.logger.warn msg + end end end end diff --git a/lib/rucaptcha/version.rb b/lib/rucaptcha/version.rb index c35894f..1e4de56 100644 --- a/lib/rucaptcha/version.rb +++ b/lib/rucaptcha/version.rb @@ -1,3 +1,3 @@ module RuCaptcha - VERSION = '1.1.2' + VERSION = '1.1.3' end