简体   繁体   中英

Empty field in ActiveAdmin Ruby on Rails

I have a form of ActiveAdmin but i cant validate de empty fields, i need show a message or something. My form is:

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

Maybe is necesary edit the controller but i dont know how i can do it

I appreciate any cooperation

You will need to add the validations on the model itself eg

class Organisation < ActiveRecord::Base

  validates_presence_of: :nombre, :descripcion, :banner


end

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM