Is there a compact way with ActiveRecord to query for what id it's going to use next if an object was going to be persisted to the database? In SQL, a query like this would look something like:
SELECT max(id) + 1 FROM some_table;
activerecordruby-on-rails
Is there a compact way with ActiveRecord to query for what id it's going to use next if an object was going to be persisted to the database? In SQL, a query like this would look something like:
SELECT max(id) + 1 FROM some_table;
Best Answer
Here is slightly modified Taryn East's version: