I'm working on a Gem that adds extra functionality to ActiveRecords. During installation, someone has to add the following to their form's erb file to get extra form elements provided by my gem:
<%= render "forms/my_gem", form: f %>
What is the best way to handle adding javascript inside my view file? I hate to have this javascript be used on every page, so I was wondering if the best approach is to add inline javascript. If you know of a gem that does this, can you please share.
Copyright Notice:Content Author:「albertski」,Reproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/63698673/recommend-approach-for-adding-javascript-from-ruby-on-rails-gem