Khushal: Fixed all the bugs related to models/queries and wrote a spec for test_case_record model