0

I have read documentation I did not find how to do this.

I need to get default_namespace setting.

Also if you could explain the process of find that method would be great.

sites
  • 21,417
  • 17
  • 87
  • 146

1 Answers1

1

The default_namespace variable is defined in Active Admin via the application.rb file

https://github.com/gregbell/active_admin/blob/9a9693b541460b43cafdb39e67247ae0a3a892b8/lib/active_admin/application.rb

This should help you find the correct call to get what you're looking for.

muttonlamb
  • 6,341
  • 3
  • 26
  • 35
  • hehehe thanks, you told me how to fish. I am going to put response here, for the ones who want just the solution `ActiveAdmin.application.default_namespace` – sites May 17 '13 at 12:49
  • Another question I am using `my_admin_route_root_path`, I was thinking to use it as `eval "#{ ActiveAdmin.application.default_namespace }_root_path"` is this bad for some reason? – sites May 17 '13 at 12:53
  • There isn't really a yes / no answer for this. I would suggest that eval be avoided wherever there is a possibility of a user interactive with the string you are eval'ing. Basically, putting in an eval when a simple variable could be used raise the risk of arbitrary code execution. Further info here http://stackoverflow.com/questions/637421/is-eval-supposed-to-be-nasty – muttonlamb May 18 '13 at 05:58
  • PS - Tip, now that Github allows you to search for code within a repo, it's super easy to find this kind of stuff now. This is a relatively recent update, but one of the most useful things they've ever done I think – muttonlamb May 18 '13 at 06:00
  • How can I search for code?, I found a way but seems is not throwing good results, with the input that is in the top bar. – sites May 18 '13 at 14:01
  • About eval, I was thinking about using `send(ActiveAdmin.application.default_namespace)`, instead of `eval`. I don't imagine how injection could happen in my case, I suppose I save the effort of thinking this using `send`, but I am not sure. – sites May 18 '13 at 14:03