I use the Rails.application.routes.generate()
and Rails.application.routes.recognize_path()
in my application to disassemble and generate URLs using the Rails routing table. I never had a problem with this using the Rails 2.3.x series but since Rails 3 (specifically 3.1.3) I've been getting the following error when invoking these commands
RuntimeError: route set not finalized
Two questions :
- Why? Am I getting this - my application is up and running and handling other requests. Why are the routes not finalized by now?
- To solve this error I call Rails.application.routes.finalize! before invoking either of these methods as it seems to work. Are there any implications to doing this?