I am reading a book about "Ruby on Rails" and one of the task includes modifying the code till now, creating additional JavaScript functionality. The JavaScript itself is easy, just few lines of code, so my question is conceptual at all.
I am executing the first activity and in the discussion folks said that the new code should be created in a separate js.erb file in the views folder.
My questions is what is the better way to solve the issue:
Create additional js.erb file in views folder
OR
Add the additional JavaScript code in the assets->javascript->viewname.js.coffee
The people from the discussion use the second technique but is it more appropriate to add the JavaScript in the assets as it will be executed with the view?
EDIT:
I am using Ubuntu 12.04 and my Rails version is 3.2.8.