Fix #35 just give a warning message if not setup a right cache_store, only raise on :null_store

This commit is contained in:
Jason Lee 2016-11-09 15:24:31 +08:00
parent 6dcfbf49bd
commit 21d1c0e787
4 changed files with 14 additions and 4 deletions

View File

@ -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 1.1.2
----- -----

View File

@ -1,7 +1,7 @@
PATH PATH
remote: . remote: .
specs: specs:
rucaptcha (1.1.2) rucaptcha (1.1.3)
railties (>= 3.2) railties (>= 3.2)
GEM GEM

View File

@ -11,16 +11,21 @@ module RuCaptcha
cache_store = RuCaptcha.config.cache_store cache_store = RuCaptcha.config.cache_store
store_name = cache_store.is_a?(Array) ? cache_store.first : cache_store store_name = cache_store.is_a?(Array) ? cache_store.first : cache_store
if [:memory_store, :null_store, :file_store].include?(store_name) if [:memory_store, :null_store, :file_store].include?(store_name)
raise " msg = "
RuCaptcha's cache_store requirements are stored across processes and machines, RuCaptcha's cache_store requirements are stored across processes and machines,
such as :mem_cache_store, :redis_store, or other distributed storage. such as :mem_cache_store, :redis_store, or other distributed storage.
But your current set is :#{store_name}. But your current set is :#{store_name}.
Please make config file `config/initializes/rucaptcha.rb` to setup `cache_store`. 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 end
end end

View File

@ -1,3 +1,3 @@
module RuCaptcha module RuCaptcha
VERSION = '1.1.2' VERSION = '1.1.3'
end end