I have a model called "Post". Because of reasons, I had to create Posts with specific id
values. When I run Post.last
, it gives me the Post with the highest id
value. However, when I run Post.create()
, it tries to create a Post with an id
greater by 1 than the id
of the last Post created without a specified id
.
The number of Posts in my database created without a specified id
has now caught up to the id
of the first Post whose id
I specified. This results in an error, because the Post that Rails tries to create would have an id
value that's already taken.
Is it possible to somehow override id
allocation, to make it go by the value of Post.last.id
?