David Kimura PRO said over 6 years ago on DRY up your Javascript :

It's a strange situation where you have two acting parts. The initial form when creating a new contact would trigger the date picker from turbolinks:load. However, when you go to edit the contact, the turbolinks:load would not trigger since it is a server generated javascript being sent back. In hindsight, the document.ready should be removed from the date_picker_init.js file and placed under the edit.js.erb since it is more applicable there.