Header_image
Jeremy Walker

Software Developer & Social Entrepreneur

Bug in setting table_name when using multiple namespaces

I've just wasted an hour on an annoying bug that rears its head only in the development environment.

There is a bug in the setting of table_name when using multiple namespaces.

This bug manifests only when "config.cache_classes" is set to false, i.e. the development environment.

> rails c
Loading development environment (Rails 3.1.0.rc1)
ruby-1.9.2-p180 :001 > ExamRoom::Practice::Question.table_name
=> "exam_room_questions"

vs

> rails c test
Loading test environment (Rails 3.1.0.rc1)
ruby-1.9.2-p180 :001 > ExamRoom::Practice::Question.table_name
=> "exam_room_practice_questions"

This can be reproduced by making a sample app with three new files and one change as outlined in the following Gist: https://gist.github.com/993158.

I will try and look into this later but I thought I'd post it in case anyone with more knowledge wants to have a look...

I've created an issue at: https://github.com/rails/rails/issues/1335.

Share This Post

Comments

No-one has posted a comment yet. Be the first!

Post a Comment

I'd love to hear your thoughts :)