Context I am learning rails and trying to create a simple webpage that has file button and submit button. When user clicks the submit button, the browser should display either "Select one or more files" or should display the size of file selected.
<script src="/assets/main_page.js.self-fce0f72385b89610aec7efdb8340722a1a1c99772f861b071c3e56ffff373e96.js?body=1" data-turbolinks-track="true"></script>
<script src="/assets/main_page.self-08dee8c4f626e100c3f8d2edde72d6a239b69493ee184c06820641df835a4b8c.js?body=1" data-turbolinks-track="true"></script>
@checkFileSize = ->
x = document.getElementById("file_tag")
if 'files' of x
if x.files.length is 0
txt = "Select one or more files."
for item in x.files
if 'size' in item
txt += "size: " + file.size + " bytes <br>"
$("#submit_tag").click (e) ->
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>
<%= csrf_meta_tags %>
<%= yield %>=
// This is a manifest file that'll be compiled into application.js, which will include all the files
// listed below.
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
// compiled file.
// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
// about supported directives.
//= require jquery
//= require jquery_ujs
//= require turbolinks
//= require raphael
//= require morris
//= require_tree .
//= require_tree . statement in your application.js will take every file in your
main_page files, you also got them in the output as
main_page.self-08dee8c4f626e100c3f8d2edde72d6a239b69493ee184c06820641df835a4b8c.js. As you can see the first file starts with
main_page.js and corresponds to your
Thus, just delete
main_page.js.js file. Rails will compile your coffee file for your.