How do you create javascript functions that are available project-wide in Ruby on Rails?

前端 未结 7 1571
攒了一身酷
攒了一身酷 2020-12-25 14:05

I put the following function in my application.js:

function test() {
  alert(\"See Me\")
}

classrooms/_new_small.html.haml:



        
7条回答
  •  暖寄归人
    2020-12-25 14:47

    Try using:

    <%= javascript_include_tag :all %>
    

    in your application.html.erb file

提交回复
热议问题