Uninitialized constant problem

I have two models in the modesl directory, say ABC.rb and DEF.rb

ABC.rb:
class AbcClass < ActiveRecord::Base

hello = Hash.new()
hello = DefClass.new #<—here is the error occur

DEF.rb:
class DefClass < ActiveRecord::Base

Do I missing anything important to create the instance?? Thanks

Ianne L. wrote:

DEF.rb:
class DefClass < ActiveRecord::Base

Do I missing anything important to create the instance?? Thanks


Posted via http://www.ruby-forum.com/.

Yes, Rails expects the name of the model file to be ‘def_class.rb’ or
‘abc_class.rb’.

_Kevin

_Kevin wrote:

Ianne L. wrote:

DEF.rb:
class DefClass < ActiveRecord::Base

Do I missing anything important to create the instance?? Thanks


Posted via http://www.ruby-forum.com/.

Yes, Rails expects the name of the model file to be ‘def_class.rb’ or
‘abc_class.rb’.

_Kevin

sorry for my incorrect example, yes, indeed I have followed the rules
of “abc_class.rb for AbcClass instance”

Thanks.

Ianne L. wrote:

Posted via http://www.ruby-forum.com/.


Posted via http://www.ruby-forum.com/.

And what error are you getting?

_Kevin