Thanks for the quick answer! Yes, I am in development mode and this is actually the problem as you described. How can I force Rails even in development mode to load ALL classes, is that possible?
Thank you, ms On 12 Mai, 00:19, Frederick Cheung <[email protected]> wrote: > On May 11, 9:32 pm, ms <[email protected]> wrote: > > > Object.const_defined?("DemandType") => false > > Object.const_get("DemandType") => Class > > > Why does const_defined?() returns false in this case? I have also > > tested it in rails console, but it was not successful. I could also > > work with const_get() alone and catch the NameError exception, but I > > would really like to know why const_defined?() is not working. > > Are you in development mode ? If so classes aren't loaded until they > are needed. const_defined? is returning false because the class does > not exist in memory. const_get triggers Rails' const_missing handler > which loads the class (and so const_get can then return it) > > Fred > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Talk" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group > athttp://groups.google.com/group/rubyonrails-talk?hl=en. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

