Javascript and rails?

Hi everyone
I’m trying to learn ruby on rails and have some questions to ask about
combining rails and javascript

Right now I’m in a situation where I’m have my ror app and another
javasciprt library that I’m using.

In my rhtml file I embedded a javascript method using
and have a button y that will call method_x() when onClick

What I like to see is when 1 user click button y, the same event will
happen to everybody who is viewing the page.

Thank you for reply