I have a dilemma. For some of my tables I want to use the fixture data
as the initial set of data for that table. This was easy enough using
the migrations helper, but I discovered a problem - I had to remove the
hard coded id values because it was causing confusion with regards to
the autogenerated sequence value (PostgreSQL) for the id column.
Ok, no problem, remove the hard coded id values and all is well.
Except that now I get “Couldn’t find MyModel without an ID” when I try
to run the unit tests. My test case is pretty basic:
class MyModelTest < Test::Unit::TestCase
@mymodel = MyModel.find(1)
run some standard tests.
Why do I need to hard code the ID value in the fixture in order to get
the tests to work? In development this works without issue - the
database just assigns sequence.nextval as the ID for the next inserted
What should I do?