Great! I'm glad that you raise the point.
Yes, I agree with you that I could have used 'js.erb' which could also be a "Rails" way to perform the simple scenario that I've created for the article.
Though use of 'js.erb' over 'js' file could be a debatable topic. Their are some scenarios like calling other functions or using some shared js dependencies in callback could lead to increase complexity in case of using 'js.erb' with few more stuff including violating the single responsibility principle. But I don't deny that it could be a solution for many cases for a "Rails" way operation and which may also opens the door for new topics to use some light-weight and fast tools like using coffeescript.