Just pushed some code to production and I'm seeing some strange behavior.
In a migration I do this..
self.up
create_table :my_table, :id => false, do |t|
t.string :id
...
end
execute 'alter table my_table set primary key (id)'
end
Then I have a before filter set up to generate a random string to use as a
the id. Because I'm paranoid of collisions I do a
if MyTable.exists?(generated_key)
generate_key
end
to test for any collisions and try again if there is one.
I've done this on a handful of tables previously and they all work
correctly.
But this one table/model has an issue. Every time I call
MyTable.exists?('xxxx') it returns true. There is 1 record in the table and
it does not have the id 'xxxx'. If I call MyTable.find('xxxx') it returns
the existing record.
Totally bizarre.
--
You received this message because you are subscribed to the Google Groups
"Heroku" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/heroku?hl=en.