cequel/cequel — pull request #187 by fun-ruby (2014-11-02 23:08:09+00:00)
Title: NoMethodError: undefined method 'ancestors' for 'astring':String

I came across this error and traced to the fact that I have some models stored in sub-directories under app/models/. In addition, the error was triggered by a model having defined class constant variables, e.g. Model::MY_CONST = 'astring'.

For some reason the Model::MY_CONST value gets included in the @new_constants collection. This is probably the main reason for the error. It seems there is more effort to fix it at the source. I also thought the class_name.constantize rescue block looks odd so decided to fix it there.

Feel free to revise if there is a better way.

Cheers,
Long