javascript_include_tag will not work js.erb declared in the view folder itself. There are three different ways to use javascript.
1] Write the code in the view, ie in html.erb itself.
2] Create a js file in the public / javascripts folder and enable it using javascript_include_tag.
3] If you want to make a request like Ajax:
source share