Using Strings as IDs

1 view
Skip to first unread message

Clayton Lengel-Zigich

unread,
Oct 12, 2009, 5:41:43 AM10/12/09
to factory_girl
I have a project which imports records from a SalesForce database.
SalesForce uses an 18 character case-insentive ID as a primary key. I
would like to create factories that can use a sequence to generate
"incrementing" string ids that are similar to the real SalesForce ids.
When I try to specify an attribute of "id" I get an ArgumentError
exception that says I've got 1 argument when I should have 0. I did
try making the id attribute accessible using attr_accessible, but no
luck there.

I poked around in the factory.rb file in the gem and didn't find
anything obvious that would allow me to do this.

Right now I'm just altering the table with a migration before I run my
tests so that the tables are using an integer ID that is auto
incrementing and the primary key, it works for now, but it's a pretty
bad hack.

Thanks,
Clayton
Reply all
Reply to author
Forward
0 new messages