Any ideas on the following error when calling create on an
NoMethodError (You have a nil object when you didn’t expect it!
You might have expected an instance of Array.
The error occurred while evaluating nil.clear):
The create method is inside a Module that I want each of my Model
classes to include. All of my DB tables follow the same structure, so
I am trying to factor out the updating and searching of the tables to
just a few Modules. My DB structure should allow it with a little
(Note: just finished reading Metaprogramming Ruby from PragProg. It
has taught me a fair bit (still loads more to learn I guess), but I
now want to refactor a current project as far as I can as a learning
If I include the Modules in the Controllers so that each Controller
gets all the functionality of the Modules, then the Controllers act
‘on’ the Model Classes and the create method succeeds, but when I move
the Module to the Model, which is where it should really be so that
the Model Class gets the methods itself, I get this error.
Have I missed something with ‘self’?
The Class that calls create does exist, and the params passed to
create are correct.
(More info available if required to help fix)