1

I have a model called class App::BaseModel into a file called base_model.rb

Then I have a message.rb file which on the first line has the following:

class App::Message < App::BaseModel

When starting the server I get the error:

/path/to/app/message.rb:1:in `<top (required)>': uninitialized constant App::BaseModel (NameError)

Can someone help me with this please?

Cheers

2 Answers2

0

for base_model.rb it should be => class BaseModel WebActivity < ActiveRecord::Base

and for message.rb it should be => class Message < ActiveRecord::Base

Lian
  • 1,597
  • 3
  • 17
  • 30
0

Rails have a naming convention, so if would like to put your model into App module (App::BaseModel), you should put the base_model.rb into app dir inside your models directory. Then Rails will load your file and class in it in a right way.

Sergey Kuznetsov
  • 8,591
  • 4
  • 25
  • 22