Is it possible to call a ruby method inside javascript? One way of implementing it is via ajax calls, but is there a way I can embed that ruby function inside the js file and call it just like calling any other js function?
4 Answers
I think you want something like RubyJS. This is a port of Google Web Toolkit to Ruby. Essentially it will let you write Ruby code that is compiled into JavaScript then run in the browser.
Comments
No. Not without using Silverlight Dynamic Languages (or similar plugin) to act as a vessel for the language.
Even then, it's not embedding into JS, it's just adding another possible language to the <script> tag.