嗨我在我的模型中使用简单的表单文本字段。创建完成后,我将添加最好的编辑和更新。现在我想给这个特定领域的最大和最小长度,请帮助我如何继续下去。如何将文本字段范围设置为rails中的best_in_place?
我需要最好的文字包装
感谢您的提前。
batchnotification.rb
class BatchNotification
include Mongoid::Document
include Mongoid::Timestamps
field :finalCount, type: Float
field :message, type: String
field :approved, type: Boolean
field :batch_id, type: Integer
field :user_id, type:Integer
validates_presence_of :approved
validates_presence_of :message
validates_length_of :message, :maximum => 5
belongs_to :batch
belongs_to :user
belongs_to :calculated_batch_counts
end
index.html.erb
<%= best_in_place notification, :message %>
它不工作我已经使用这个sreeraj nyros – Kiran