Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ActiveAdmin resource for a namespaced resource #2394

Closed
karangb opened this issue Aug 4, 2013 · 6 comments
Closed

ActiveAdmin resource for a namespaced resource #2394

karangb opened this issue Aug 4, 2013 · 6 comments

Comments

@karangb
Copy link

karangb commented Aug 4, 2013

I am using ActiveAdmin for the first time. I am trying to create an administration page for a model that lives under my "Core" engine. I hence have defined a active_admin file as follows:

ActiveAdmin.register Core::Property do

end

This creates a tab within the active_admin tab section. However, I get the following error:

No route matches {:action=>"new", :controller=>"admin/core_properties"} missing required keys: []

How can I fix this?

Thanks"

@seanlinsley
Copy link
Contributor

That's odd; a routing error complaining that... nothing extra is required for routing.

  1. On what page are you getting this error? Is it when you visit /admin/core_properties?
  2. What version of Rails, and AA, are you running?
  3. Are you able to successfully register other models in your app?

@karangb
Copy link
Author

karangb commented Aug 4, 2013

Hi,

  1. I just noticed that I am getting the error even on the /admin/comments page.
  2. Rails 4 and edge copy of AA
  3. no.
    I just reinstalled a fresh copy of rails and applied AA to it, and the comments page works. I believe I must have done something interesting to get that to fail in my main application.

I am going to revert my changes, and try again.

@seanlinsley
Copy link
Contributor

You should be sure to use the rails4 branch of AA.

Hopefully you get it sorted!

@karangb
Copy link
Author

karangb commented Aug 4, 2013

Yeah, that is the one I am using. I will report my findings here :)

@karangb
Copy link
Author

karangb commented Aug 5, 2013

Okay, I found the solution. I had another admin engine living in my application, and hence occupied the admin namespace (which was also being used by active_admin).

Effectively, it was a namespace conflict. By either changing the namespace on active_admin, or the other engine, the issue was resolve.

@seanlinsley
Copy link
Contributor

Ah. It seems like the only way to fix that would be:

# lib/active_admin/namespace.rb
def register_module
  if const = "::#{module_name}".safe_constantize
    raise "foo" unless const.const_defined? :CREATED_BY_ACTIVE_ADMIN
  end
  eval "module ::#{module_name}
    CREATED_BY_ACTIVE_ADMIN = true
  end"
end

@karangb karangb closed this as completed Aug 5, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants