i am having the following function call and function definition in xyz.js.erb file. but the function is not calling.
merge_cells();
function merge_cells() {
}
Writing javascript function definition in js.erb file is not a good way. You can move that function to application.js file
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> library in my xyz.js.erb file, then the method is calling. but this link i added to the view page already which is got some stuff used by the xyz.js.erb file.