You cannot do this, because javascript is executed on the client side, and the code in the ERB file works on the server side, you can send the value using an ajax request, Plus there are awsome cast rails here
javascript ; "Apply", "set_id" , , .., div "id_message" .
$('#apply').live('click', function(event, data, status, xhr) {
event.preventDefault();
return $.ajax({
url: '/users/registrations/set_id',
type: 'GET',
data: {
code: $('#user_id').val()
},
success: function(data, event, status, xhr) {
$('#id_message').html(response);
return $("#id_message").show();
},
error: function(event, data, status, xhr) {
$('#id_message').html(response);
return $("#id_message").show();
}
});
});
, .