2013-02-22 2 views
3

Мне нравится новая функция .error_notification в simple_form, но я понятия не имею, как включить в нее мою recaptcha. Код у меня выглядит следующим образом:Как заставить Ambethia Recaptcha работать с simple_form .error_notification?

<%= simple_form_for(resource, :as => resource_name, :url =>  registration_path(resource_name)) do |f| %> 
    <%= f.error_notification %> 
    <div class="form-inputs"> 
    <%= f.input :email, :required => true, :autofocus => true %> 
    <%= f.input :password, :required => true %> 
    <%= recaptcha_tags %> 
    </div> 

    <div class="form-actions"> 
    <%= f.button :submit, "Sign up" %> 
    </div> 
<% end %> 

Я полагаю, мне нужно как-то сказать simple_form нечто большее о рекапчи, но я не могу найти много информации о .error_notification.

Спасибо за помощь!

+1

Вам удалось решить эту проблему? – gotqn

+0

было ли это разрешено? – DogEatDog

ответ

1

В контроллере:

unless verify_recaptcha 
    @captcha_error="Word verification response is incorrect" 
end 

Ввиду:

<%= recaptcha_tags %> 
<span class="help-block pull-left" style="color:#a94442;"><%[email protected]_error%></span> 

Вы можете использовать переменную, чтобы показать ваше сообщение об ошибке.