//= require action_cable
//= require_self
//= require_tree .

this.App = {};

App.cable = ActionCable.createConsumer();

App.messages = App.cable.subscriptions.create('MessagesChannel', {
  received: function(data) {
    console.log(data)
    $('#messages').removeClass('hidden')
    // append message
    $('#messages').append(data.message);
    // scroll down to latest message
    $("#messages").scrollTop($('#messages')[0].scrollHeight);
  }
});

//= require action_cable
//= require_self
//= require_tree .

this.App = {};

App.cable = ActionCable.createConsumer();

App.messages = App.cable.subscriptions.create('MessagesChannel', {
  received: function(data) {
    console.log(data)
    $('#messages').removeClass('hidden')
    // append message
    $('#messages').append(data.message);
    // scroll down to latest message
    $("#messages").scrollTop($('#messages')[0].scrollHeight);
    // clear #message_content input field
    $('#message_content').val('');
  }
});

Revert "Do not clear input field when receiving message"
Revert "Do not clear input field when receiving message"

This reverts commit 6e64d42b1a8deffadd325c43eb1184eb0b56a92c.
