Apipie / apipie-rails

Ruby on Rails API documentation tool
Apache License 2.0
2.47k stars 459 forks source link

0.0.14 breaks namespaced controllers with :root directed to apipie outside RAILS_ENV=development #89

Open amalc opened 11 years ago

amalc commented 11 years ago

Symptom (Reproducible):

  1. Take an existing namespaced API controller, i.e. apps/api/v1/do_something_controller.rb
  2. Lock apipie to version 0.0.13
  3. Ensure :root point to 'apipie/apipies' in route.rb
  4. Browse to application running where RAILS_ENV=production.
  5. Everything works!
  6. Switch to 0.0.14.
  7. Reload and repeat step 4.
  8. Error from Rails. "Expect apps/api/v2/do_something_controller.rb to define Api::V1::DoSomething.

Oddly enough, no problems when running in development.

The "VERSION" tag is also broken, but I expect that was intentional?

iNecas commented 11 years ago

Hi, thanks for report.

Is there a possibility that you have set reload_controllers = true for Apipie.configure? I was able to reproduce this only when reload_controllers = true in production mode. The :root doesn't seem to have affected this.

If reload_controllers was not touched by you, we have to find better reproducer, maybe by forking https://github.com/iNecas/apipie-demo and breaking the results branch so that it shows the error.

pcai commented 11 years ago

+1 on this, happening between the .13 and .14 builds - no changes to our application. Removing reload_controllers option fixed it. It works fine in development as amalc says.