Improve Error When Converting Records without an Id
fny opened this issue · comments
Model.new.to_global_id
currently raises a URI::InvalidComponentError
with the message URI::InvalidComponentError: Expected a URI like gid://app/Person/1234: #<URI::GID gid://app>
. An error particular to GlobalID
would be useful:
GlobalID::UnidentifiableRecord Unable to identify #{record.class} without an id. (Maybe you forgot to call save?)
This is already being discussed in rails/rails#19861 and rails/rails#19877.