Hi,

I am trying to create routes at runtime but I am finding this a but of a 
challenge. I can get it to register as a route using the code below but 
then when url_for( with_url_options ) is called it throws an on any 
different fout error:

No route matches {:action=>"index", 
:controller=>"admin/scientific_review_processes__1__1s"

When I try to load a different meta model/controller/route I have to 
stop/start the server and it will work. I want to be able to load and 
unload controllers/models and routes at runtime but I have yet to make this 
work correctly. 


    private
        def create_route(table_name)

        #  if 
Rails.application.routes.named_routes.routes["admin_#{table_name}".to_sym].nil?
            Rails.application.routes.disable_clear_and_finalize = true

              Rails.application.routes.draw do
                namespace :admin do
                  resources table_name.to_sym do as_routes end
                end
              end
              #binding.pry
              #Rails.application.routes.finalize!
          #  ActiveSupport.on_load(:action_controller) 
{Rails.application.routes.finalize! }
        #  end
        end

Does anyone know what would make such a thing work in a runtime 
environment? 

Thanks in advance,
Mark

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Core" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/rubyonrails-core.
For more options, visit https://groups.google.com/d/optout.

Reply via email to