Update controller_helpers.rb
在ruby2.2.0p0版本中,&& 与 and 的优先级不同。 right = true && false right = true and false 的结果不一样
This commit is contained in:
parent
62d3655842
commit
c310c25781
|
@ -18,7 +18,7 @@ module RuCaptcha
|
||||||
end
|
end
|
||||||
|
|
||||||
def verify_rucaptcha?(resource = nil)
|
def verify_rucaptcha?(resource = nil)
|
||||||
right = params[:_rucaptcha].present? and session[:_rucaptcha].present? and
|
right = params[:_rucaptcha].present? && session[:_rucaptcha].present? &&
|
||||||
params[:_rucaptcha].downcase.strip == session[:_rucaptcha]
|
params[:_rucaptcha].downcase.strip == session[:_rucaptcha]
|
||||||
if resource && resource.respond_to?(:errors)
|
if resource && resource.respond_to?(:errors)
|
||||||
resource.errors.add(:base, t('rucaptcha.invalid')) unless right
|
resource.errors.add(:base, t('rucaptcha.invalid')) unless right
|
||||||
|
|
Loading…
Reference in New Issue