2012-03-06 54 views
0

我试图设置显然很简单的Humanizer宝石,但我明显做错了什么,因为邮件发送不管正确的答案。Humanizer宝石不工作

我的消息的方法,包括:

include ActiveModel::Validations 
include ActiveModel::Conversion 
extend ActiveModel::Naming 

attr_accessor :name, :email, :subject, :body 

validates :name, :email, :subject, :body, :humanizer_answer, :presence => true 
validates :email, :format => { :with => %r{[email protected]+\..+} }, :allow_blank => true 

include Humanizer 
require_human_on :create 

,并在我的形式:

<%= form.label :humanizer_answer, @message.humanizer_question %> 
<%= form.text_field :humanizer_answer %> 
<%= form.hidden_field :humanizer_question_id %> 

我到底做错了什么?它看起来如此简单...

回答

3

Humanizer不能在非ActiveRecord型号上工作