How to prevent enter key submit in rails

Enter key submit is not a rails problem, it's an HTML / JS problem

Rails is backend (lives on the server); HTML / JS are client-side (live in browser) - they determine what functionality is enabled / disabled

I would get around your problem like this:

$('form').on('keypress', e => {
    if (e.keyCode == 13) {
        return false;
    }
});

And if you're using Turbolinks:

$(document).on('turbolinks:load', () => {
    $('form').on('keypress', e => {
        if (e.keyCode == 13) {
            return false;
        }
    });
});

Good reference: How to prevent ENTER keypress to submit a web form?