簡體   English   中英

ActiveAdmin Ruby on Rails中的空白字段

[英]Empty field in ActiveAdmin Ruby on Rails

我有一種ActiveAdmin形式,但我無法驗證空字段,我需要顯示一條消息或其他內容。 我的表格是:

form multipart: true do |f|
  f.inputs "Organización" do
    f.input :nombre, :label => "Nombre"
    f.input :descripcion, :label => "Descripción" 
    f.input :banner, as: :file, hint: image_tag(f.object.banner.url), label: "Banner"
  end
  f.actions
end

也許需要編輯控制器,但我不知道該怎么做

多謝合作

您將需要在模型本身上添加驗證,例如

class Organisation < ActiveRecord::Base

  validates_presence_of: :nombre, :descripcion, :banner


end

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM