To reset the primary key sequence of a table in a PostgreSQL backed Ruby on Rails application, run:
ActiveRecord::Base.connection.reset_pk_sequence!('table_name')
The method is not publicly documented, but you can find more details in the implementation.