#16 ✓hold
Chris

map.from_plugin in a namespace?

Reported by Chris | June 3rd, 2008 @ 03:31 AM

I know this might be a stupid idea, but I want to use the routes from an engine in a namespace like:

  namespace :admin do |admin|
     admin.from_plugin :members_engine
  end

I tried it, but it didn't work; I also changed the from_plugin method to something like this, so it doesn't throw an exception:

  def from_plugin(name, *options)
      map = self # to make 'map' available within the plugin route file
      routes_path = Engines.plugins[name].routes_path
      Engines.logger.debug "loading routes from #{routes_path}"
      eval(IO.read(routes_path), binding, routes_path) if File.file?(routes_path)
  end

However the path_prefix stuff gets ignored an I have no idea how to cram it in there. Also I have no idea how the namespacing would affect my engine's controllers, since they would have to be put into a module (like Admin::MembersController).

Comments and changes to this ticket

  • James Adam

    James Adam September 13th, 2008 @ 02:57 AM

    • State changed from “new” to “hold”
    • Tag cleared.

    This would be great to support, but it's not a top priority at the moment. Feel free to work up some tests and a patch though...

  • pjammer

    pjammer March 15th, 2009 @ 04:03 AM

    hi, i know this ticket is on hold but wanted to report that i did the following in my engines plugin/routes.rb file and it worked fine

    
    resources :model
    namespace :admin do |admin|
      admin.resources :model
    end
    

    i now get to use admin_model_path in my /admin/model routes.

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

The rails engines plugin itself

Shared Ticket Bins

People watching this ticket

Pages