niftygrifty
niftygrifty

Reputation: 3652

Blank ActiveAdmin pages

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...

Upvotes: 1

Views: 630

Answers (1)

Shamsul Haque
Shamsul Haque

Reputation: 2451

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

Upvotes: 0

Related Questions