In app/models/sudoku
, I have 6 classes.
app/models/sudoku/sudoku.rb
app/models/sudoku/board.rb
app/models/sudoku/cell.rb
app/models/sudoku/row.rb
app/models/sudoku/column.rb
app/models/sudoku/block.rb
class Sudoku < ActiveRecord::Base
calls class Board
, and class Board
calls class Cell
, class Row
, etc. Like this:
- sudoku.rb
- board.rb
- cell.rb
- column.rb
- row.rb
- block.rb
When I run the code on class Sudoku
, I get a Unable to autoload constant Sudoku::Board
error. I understand this completely, that when you add a new sub-dir into the models
dir, you need to have the name space convention.
But, when I name app/models/sudoku
to app/models/foo
, I don't have to use ANY name space.
Why does this happen?
Aucun commentaire:
Enregistrer un commentaire