Basically, what I want to accomplish is to allow user to preview their uploaded image before they submit it.
In the controller, i have
def index @tem
this worked in my case:
$('.file-input').on 'change', (event) -> $('.image').attr('src', URL.createObjectURL(this.files[0]))