Ruby on rails 3 Rails简单验证码属性

Ruby on rails 3 Rails简单验证码属性,ruby-on-rails-3,simplecaptcha,Ruby On Rails 3,Simplecaptcha,当我在rails 3项目gem中使用“simple captcha”(简单验证码)时,调用函数时出现了错误: 解决方案: 通过使用rails 3应用程序的替代存储库 gem 'simple_captcha', :git => 'git://github.com/rubymaniac/simple-captcha' 这对我很有用: 将其放入初始值设定项(config/initializers/simple\u captcha.rb) Rails.configuration.to\u pre

当我在rails 3项目gem中使用“simple captcha”(简单验证码)时,调用函数时出现了错误:

解决方案: 通过使用rails 3应用程序的替代存储库

gem 'simple_captcha', :git => 'git://github.com/rubymaniac/simple-captcha'
这对我很有用:

将其放入初始值设定项(config/initializers/simple\u captcha.rb)

Rails.configuration.to\u prepare do
类SimpleCaptcha::SimpleCaptchaData<::ActiveRecord::Base
属性保护
结束
结束

我收到此错误,因为我使用的是基于表单的视图代码:

<%= f.simple_captcha(:label => "Enter letters from image above", :placeholder => "") %>
“输入上面图像中的字母”,:占位符=>”)%>
我认为这是因为f引用了我的用户模型,这可能 不引用验证码属性。我放弃了表单基础和问题 他走了。(尝试了上述两种解决方案,但在我的情况下都不起作用。):

“输入上图中的字母”,
:占位符=>“”)%>
Rails.configuration.to_prepare do
  class SimpleCaptcha::SimpleCaptchaData < ::ActiveRecord::Base
    attr_protected
  end
end
<%= f.simple_captcha(:label => "Enter letters from image above", :placeholder => "") %>
<%= show_simple_captcha(:label => "Enter letters from image above",
                        :placeholder => "") %>