"model :modelX" deprecated

Hi, my app is using single table inheritance and has run into the "uninitialized constant" error once I remove the model call.

I set up my STI using the instructions in the wiki, which I am guessing are badly out of date now:

http://wiki.rubyonrails.org/rails/pages/SingleTableInheritance "If you have an "uninitialized constant" error: Note: Rails must 'see' the file containing the STI classes before it can use them, otherwise you'll end up with an "uninitialized constant" error. This can be a problem if the name of the class and the name of the file defining it are not the same, e.g. you have the model 'Manager' in the file 'employees.rb'. Rails will not be able to divine the filename from the class name in this case.

An easy way to do fix this is to add "model :employees" to your application.rb controller, where 'employees' is the name of the file containing the STI class minus the extension (so in this case, the model would be contained in a file named 'employees.rb'.) This forces Rails to load that file and 'see' all the models you have defined in it, and it will then know of your STI classes when you go to use them."

Short of adding a file for each child model in the inheritance tree, does anyone have a work around for this?

Hi, my app is using single table inheritance and has run into the "uninitialized constant" error once I remove themodelcall.

I set up my STI using the instructions in the wiki, which I am guessing are badly out of date now:

...

Short of adding a file for each childmodelin the inheritance tree, does anyone have a work around for this?

Assuming that all your STI classes are defined in app/model/modelx.rb try using

  require 'modelx'

In application.rb rather than

  model :modelx