This may seem like a bit of an odd question, but I was wondering if anyone could think of any cunning means of getting the equivalent of the output of "rake routes" from within a controller. I.e., I''d like to be able to GET a URL such as http://localhost:3000/routes and have a summary of the available routes returned. One possible way I can see would be to have the relevant controller make a system call to "rake routes"and render the output as text, or to prepare such output beforehand with a cron job and source it from a text file, but neither option seems very elegant. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Fri, Jan 28, 2011 at 6:39 AM, Milo Thurston <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> This may seem like a bit of an odd question, but I was wondering if > anyone could think of any cunning means of getting the equivalent of the > output of "rake routes" from within a controller. I.e., I''d like to be > able to GET a URL such as http://localhost:3000/routes and have a > summary of the available routes returned.You could just incorporate the code from the rake task into a model of your own, eh? -- Hassan Schroeder ------------------------ hassan.schroeder-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org twitter: @hassan -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Hassan Schroeder wrote in post #978177:> You could just incorporate the code from the rake task into a model > of your own, eh?Thanks - I should have thought of that… It seems that the relevant line I was looking for is: Rails.application.routes.routes …which produces what is required. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.