如何让ambethia的captcha插件在rails 3中运行?

时间:2010-06-11 21:39:59

标签: ruby-on-rails ruby-on-rails-plugins captcha ruby-on-rails-3

我已经在我的rails 3应用中安装了ambethia's captcha plugin插件。当我将<%= recaptcha_tags %>放在我的视图中时,它会在页面上打印出来:

<script type="text/javascript" src="http://api.recaptcha.net/challenge?k=my_key&error=expression"></script> <noscript> <iframe src="http://api.recaptcha.net/noscript?k=my_other_key" height="300" width="500" frameborder="0"></iframe><br/> <textarea name="recaptcha_challenge_field" rows="3" cols="40"></textarea> <input type="hidden" name="recaptcha_response_field" value="manual_challenge"></noscript> 

有没有办法让我在rails 3中完成这项工作?我很感激任何帮助。

2 个答案:

答案 0 :(得分:2)

<%=raw recaptcha_tags %>

答案 1 :(得分:0)

你已经接受了一个答案,但是,我和Devise一起使用它并且不需要使用raw - 是的,我在Rails 3上:

应用程序/视图/用户/注册/ new.html.erb

<h2>Sign up</h2>

<%= form_for(resource, :as => resource_name, :url => registration_path(resource_name)) do |f| %>
  <%= devise_error_messages! %>

  <p><%= f.label :email %><br />
  <%= f.text_field :email %></p>

  <p><%= f.label :password %><br />
  <%= f.password_field :password %></p>

  <p><%= f.label :password_confirmation %><br />
  <%= f.password_field :password_confirmation %></p>

  <p><%= recaptcha_tags %></p>

  <p><%= f.submit "Sign up" %></p>
<% end %>

<%= render :partial => "devise/shared/links" %>

其余代码在文章中:http://www.communityguides.eu/articles/10