diff --git a/lib/friendly_id/slugged.rb b/lib/friendly_id/slugged.rb index 6e0e13542..d7f0699cf 100644 --- a/lib/friendly_id/slugged.rb +++ b/lib/friendly_id/slugged.rb @@ -375,7 +375,7 @@ def slug_generator private :slug_generator def unset_slug_if_invalid - if errors.present? && attribute_changed?(friendly_id_config.query_field.to_s) + if errors[friendly_id_config.query_field].present? && attribute_changed?(friendly_id_config.query_field.to_s) diff = changes[friendly_id_config.query_field] send "#{friendly_id_config.slug_column}=", diff.first end