I have a model called Contents, and every content belongs to a Role.
The Roles are suposed to be constants (they are always the same and
don’t change), so I decided to create a migrate to insert the data in
the db. The point was that every role has more properties, like
priority, and I found it was not a good idea to create a simple class
with normal constants. Furthermore, I added a method (const_missing)
in the model Role so when I search a constant it checks the db table
and creates it dinamically.
My problem appeared when I was writing the tests because the migrates
don’t get executed, and so I don’t have any role in my test db. And
they are suposed to be constants and be always there.
In another project we used fixtures to fix this problem but I don’t
think that it’s the best way because you must keep synch the db and
the fixtures. Quite ugly.
Thanks in advance for your answers.