1
votes

My ActiveAdmin index page for ad_images works fine but new, edit, and view look blank like this...

blank active admin new page

admin/ad_image.rb looks like this:

ActiveAdmin.register AdImage do
  permit_params :name, :url, :imageable_type, :imageable_id

  form(:html => { :multipart => true }) do |f|
    f.inputs "Ad Image" do
      f.input :name
      f.input :url, as: :file
      f.input :imageable_type
      f.input :imageable_id
    end
    f.actions
  end

end

The AdImage model works normally otherwise. Any clue what's going on?

UPDATE

Turns out that "ad_image" conflicts with a formtastic style of the same name... I think? When I remove the "ad_image" class from the form (which is added automatically) everything works fine.

I can give an alias to my ActiveAdmin class like so

ActiveAdmin.register AdImage, as: "ImagesForAds"

... and the form will appear. But now I can't save anything...

1
If you found a solution to your problem you should answer your own question and mark it as the solution. - Besi

1 Answers

0
votes

Edit admin/ad_image.rb :---

ActiveAdmin.register AdImage do
  permit_params :name, :url, :imageable_type, :imageable_id

  form do |f|
    f.inputs "Ad Image" do
      f.input :name
      f.input :url, as: :file
      f.input :imageable_type
      f.input :imageable_id
    end
    f.actions
  end

end