2012-03-06 80 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型號上工作