Your problem is that f.id=1 is "set the primary key to 1". See this doc: ActiveRecord::Base
I don't know how you "fix" this in your situation, but knowing the cause ought to help.
-Rob
Rob Biedenharn http://agileconsultingllc.com Rob@AgileConsultingLLC.com