5

Consider the following ActiveAdmin page:

ActiveAdmin.register_page "Import" do
    content do
        form :action => some_path, :method => :post do |f|
            f.input :name => :table, :collection => { "Display" => "id" }
        end
    end
end

Using this code anywhere within an ActiveAdmin resource works as you would expect, using FormBuilder to create a Formtastic form. When using AA's register_page method, however, and placing a form in the content section, it doesn't seem to work as hoped. Am I missing something or could this be something that's been overlooked? I might create the form in a partial rather than use AA's DSL, but it would be nicer to keep it within the AA resource.

Anyone got a clue why it won't play nice?

1
  • Please be a little more specific when you say, 'won't play nice.' What did you expect to see? What did you actually see? Commented Nov 14, 2013 at 16:33

1 Answer 1

1

Actually I noticed that too in the past. My problem was that it seemed Cancan wouldn't work properly anymore when I would go to one of my own custom page...disregarding the admin abilities I had set.

If you look at your logs though, you'll notice that Custom pages render the following:

app/views/active_admin/page/index.html.arb

whereas a "normal" resource page renders the following

app/views/active_admin/resource/index.html.arb

So I think any helpers/methods tied to ActiveAdmin and ActiveRecord models won't work in custom page. Seems like they only work if it renders templates under /resource/*

Just like you said..I went around that problem by creating my own partials !

Sign up to request clarification or add additional context in comments.

1 Comment

Hopefully it's something queued for resolution in future updates of AA, but its not justification for my spending any time on given that there is a clear workaround.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.