-2

I'm trying to model some UI elements.

I've created a series of classes in /app/models/wrappers/*

For this post i'm going to focus on a class called InputTextVO

I have:

class InputTextVO
...
end

/app/models/wrappers/InputTextVO.rb

When I try and initialize it in my controller I get the following:

NameError in InputsController#index
uninitialized constant InputsController::InputTextVO

@ivo = InputTextVO.new

RubyMine can locate the class and doesn't report any errors in my controller.

Uri Agassi
  • 36,848
  • 14
  • 76
  • 93
Jack Murphy
  • 2,952
  • 1
  • 30
  • 49

1 Answers1

1

You must to add a module if you want to create a subdirectory in the model directory. You can do it like this :

class Wrappers::InputTextVO
...
end
Wrappers::InputTextVO.new #....

It should work.

You can also create a new directory like this app/wrapper.

Dougui
  • 7,142
  • 7
  • 52
  • 87