I've the following:
I defined two classes 'Super' und 'Sub' in two separate files that look
like this:
class Super < ActiveRecord::Base
end
class Sub < Super
end
After compiling 'Sub' I get the following error message "uninitialized
constant Super (NameError)"
Ruby doesn't consider 'Super' as a class but rather as a constant. Does
anyone know how I can avoid this?
I've the following:
I defined two classes 'Super' und 'Sub' in two separate files that look
like this:
class Super < ActiveRecord::Base
end
class Sub < Super
end
After compiling 'Sub' I get the following error message "uninitialized
constant Super (NameError)"
Ruby doesn't consider 'Super' as a class but rather as a constant. Does
anyone know how I can avoid this?
I've the following:
I defined two classes 'Super' und 'Sub' in two separate files that look
like this:
class Super < ActiveRecord::Base
end
class Sub < Super
end
After compiling 'Sub' I get the following error message "uninitialized
constant Super (NameError)"
Ruby doesn't consider 'Super' as a class but rather as a constant. Does
anyone know how I can avoid this?
Thanks in advance.
You haven't shown enough code. Does the Sub class file have this at the top:
After compiling 'Sub' I get the following error message "uninitialized
constant Super (NameError)"
Ruby doesn't consider 'Super' as a class but rather as a constant. Does
anyone know how I can avoid this?
Thanks in advance.
You haven't shown enough code. Does the Sub class file have this at the
top:
require 'super'
That's all of the code I have. I have just two empty classes - one
should be the subclass and the other the superclass.
After writing "require 'super'" at the top of the 'sub'file I get
"uninitialized constant ActiveRecord (NameError)"
You haven't shown enough code. Does the Sub class file have this at the
top:
require 'super'
That's all of the code I have. I have just two empty classes - one
should be the subclass and the other the superclass.
After writing "require 'super'" at the top of the 'sub'file I get
"uninitialized constant ActiveRecord (NameError)"
Odd, isn't ?
Not, it's not odd, it means that, because you put "require 'super'" at the
top of the sub class file, the sub class found the super class, and you now
have an new problem. The new problem is the absence of:
require 'activerecord'
at the top of the super class file.
Before, the sub class couldn't find a definition for 'super'. Now super
can't find a definition for 'activerecord'.
Each Ruby source file that requires information from outside itself ... must
say so.
Not, it's not odd, it means that, because you put "require 'super'" at
the
top of the sub class file, the sub class found the super class, and you
now
have an new problem. The new problem is the absence of:
require 'activerecord'
at the top of the super class file.
Before, the sub class couldn't find a definition for 'super'. Now super
can't find a definition for 'activerecord'.
Each Ruby source file that requires information from outside itself ...
must
say so.
Many thanks for the response Paul,
after putting "require 'activerecord'" at the top of the super class I
have now a new error message
"{RUBY_HOME}/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
`gem_original_require': no such file to load -- activeRecord
(LoadError)"
Do you know how to handle that?
Paul Lutus wrote:
> Yu Co wrote:
>
> / ...
>
>>
>> Odd, isn't ?
>
> Not, it's not odd, it means that, because you put "require 'super'" at
> the
> top of the sub class file, the sub class found the super class, and you
> now
> have an new problem. The new problem is the absence of:
>
> require 'activerecord'
>
> at the top of the super class file.
>
> Before, the sub class couldn't find a definition for 'super'. Now super
> can't find a definition for 'activerecord'.
>
> Each Ruby source file that requires information from outside itself ...
> must
> say so.
Many thanks for the response Paul,
after putting "require 'activerecord'" at the top of the super class I
have now a new error message
"{RUBY_HOME}/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
`gem_original_require': no such file to load -- activeRecord
(LoadError)"
Do you know how to handle that?
It's require 'active_record' (Note the underscore).
···
On Wed, Sep 20, 2006 at 11:27:47AM +0900, Yu Co wrote: