Rails Fixtures with Legacy Database
My setup was:
MySQL Table name: TABLENAME (all caps)
Rails Model name: TableName (camel case)
- The fixture file has to be
TABLENAME.yml(not case sensitive) -
fixtures()takes the symbol name of the Model, in this case:tableName(note the first lowercase letter) This is the bit that drove me mad - i was writing fixtures:TableNamewhich appeared to work, but then the test failed if I triedTableName(:foo) - Now you can write
tableName(:foo)