I am trying to add validation in Active Admin model, and doing it as follow:
ActiveAdmin.register Skill do
permit_params :title, :text, :status
validates :title, length: { maximum: 20 }, presence: true
end
and it gives following error:
undefined method `validates' for # ActiveAdmin::ResourceDSL:0x007f576cab00c0
When I use same thing on frontend model then it works fine, don't know what's going on.
Try to add validation in the Active record model instead in the active admin.
Add
validates :title, length: { maximum: 20 }, presence: true
in the Skill
model