How to show base errors on active_admin gem

In the admin area, how do i go about and show the base errors (errors not specific to a field?). Ideally i would like to do this for all models.

Thanks

Answers


Well I hope I don't get flamed for this, but I dug into the ActiveAdmin Code and found where the default form options are.

Monkey Patch:

module ActiveAdmin::Views::Pages
  class Form < Base
    private
    def default_form_config
      ActiveAdmin::PagePresenter.new do |f|
        f.semantic_errors
        f.inputs
        f.actions
      end
    end
  end
end

That will make all the forms by default show errors that were added to base.


I just found an easy way to get them.. but you still have to override the form:

ActiveAdmin.register Blah do

  form do |f|
    f.semantic_errors :blah
    f.inputs do
      f.input :one
      f.input :two
    end
    f.buttons
  end  

end

Update You can simplify it like this too:

  form do |f|
    f.semantic_errors :blah
    f.inputs
    f.buttons
  end  

end

Need Your Help

PHP Form multiple buttons

php javascript forms button

I have a form with 2 buttons, that depending on which is selected will either be deleted or edited from the database. Those are each individual pages using SQL statements (questionedit and

PHP Objects and Closures

php object scope closures anonymous-function

I've been asking a few questions on this topic recently, so I feel it appropriate to link up the associated question(s).

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.