Humanizer gem不起作用

时间:2012-03-06 01:15:03

标签: ruby-on-rails ruby

我正在尝试设置一个看似简单的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{.+@.+\..+} }, :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 %>

我做错了什么?它看起来很简单......

1 个答案:

答案 0 :(得分:3)

Humanizer不适用于非ActiveRecord模型