When I create a new Invoice in my Rails program friendly_id is updating the history with the new slug. What do I need to do to fix this issue.
Currently I have no idea how to fix this in my program.
extend FriendlyId
friendly_id :slug_candidates, use: %i[history slugged finders scoped], scope: :educator_id
I used above to import history and slugged. I also added the following method for creating the Invoice numbers of a slug
def slug_candidates
# TODO: check what happens if you have 2 educators with same invoice number
[:number, %i[number id]]
end
def should_generate_new_friendly_id?
slug.blank? || number_changed?
end