title: Rails calling a javascript function from a user defined class
body: <p>I have a custom class named <strong>NotificationManager</strong> in which i have defined a method, <strong>update_notification</strong>. I want to call a javascript function inside this method. I have tried using the <strong>respond_to</strong> method and, since it is not a controller action, it can not be called there.  </p>
  
  <p>This is my code.</p>
  
  <pre><code>class NotificationManager
     def update_notification
        //here i want to call a javascript function
     end
  end
  </code></pre>