Search code examples
ruby-on-railsactiveadmin

Where do I define method for ActiveAdmin forms?


I am new to working with ActiveAdmin. I've read the documentation and watched a RailsCast but this is my first time doing anything with it. I need a field called "disclaimer" to a form. I have already added the field to the relevant database table and run the migration, and then confirmed that this new column is definitely in the table. Here is the form:

  form do |f|
    f.inputs 'Information' do
      f.input :title
      f.input :description, input_html: { rows: 3 }
      f.input :campaign, label: 'CAMPAIGN NAME',
              wrapper_html: { class: 'raw-case-label'}
      f.input :disclaimer
    end
    #other fields
  end

The only part I added is f.input :disclaimer. I am now getting this error:

undefined method `disclaimer' for #<PromotionalNewsletter:0x00007fb901f4a6e8>

Although it seems odd that this would need a method, the error message seems straightforward. I assumed I would just need to add a method, using the existing inputs as examples. The problem is that I cannot find these existing examples anywhere. Other columns don't seem to have methods defined for them.

Can someone please explain what I need to do?

EDIT: Restarting the server worked


Solution

  • @dbugger answered my question. Not sure how to mark this as resolved.