I am adding a 3rd party feature into an existing rails app. The 3rd party gave me a piece of code which I am supposed to drop into my codebase but I’m confused as to where this should be posted.
Posted is the 3rd party which I am supposed to add to my codebase:
<script src="http://serviceweareusing.com/js/version-latest?cid=ourcompany"></script>
<script>
$("#textbox").featureBox('init',{rte:true,userid:'<ENTER CURRENT USERNAME>'});
</script>
Posted is the existing code in my app for the form.
_post_form.html.erb
<div class="create-post-row">
<label>Body</label>
<textarea id="textbox">
<%= @post.body %>
</textarea>
<%= form.hidden_field :body, :id => 'body_hidden_input' %>
<%= errors_for_field :body %>
</div>
Where should this be posted? Does it go in a separate .js file or can I paste it right into the embedded ruby? Any insight would be great.
Make a .js file in your /app/assets/javascripts folder.
make sure your “application.js” file has //= require_tree . at the end.