我正在尝试设置看似简单的Humanizer gem,但我显然做错了什么,因为无论正确答案如何,都会发送消息。
我的message方法包含:
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 %>我做错了什么?看起来很简单。
发布于 2012-10-19 18:36:20
Humanizer不适用于非ActiveRecord模型
https://stackoverflow.com/questions/9576532
复制相似问题