This happens if the id column value is explicitly specified in the insert statement.
For each id column, there is a sequence in Postgres that is usually called tablename_columnname_seq, for example user_id_seq.
Please check the name in the table definition in pgadmin3, because the rails do not support sequences with other names.
You can fix the sequence with an identifier too low by doing something similar to:
SELECT setval('user_id_seq', 10000);
To find out the largest number: SELECT max (id) FROM users;
SELECT max(x) FROM
(SELECT max(id) As x FROM users
UNION SELECT last_value As x FROM user_id_seq As y);