(Rails) What is “RJS”?

后端 未结 3 784
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-13 18:42

I\'ve seen \"RJS\" and \"RJS templates\" mentioned in passing in blog posts and tutorials. I did a search, but I\'m still unsure about it. Is it a technology specific to Rai

相关标签:
3条回答
  • 2020-12-13 18:55

    RJS was a "ruby-to-js" template system, RJS is not widely used anymore in the Rails ecosystem. SJR (Server-generated JavaScript Responses) is now prefered.

    This DHH's post helped me a lot to understand : https://signalvnoise.com/posts/3697-server-generated-javascript-responses

    0 讨论(0)
  • 2020-12-13 18:57

    This Railscast gives a nice example of using RJS to add and remove form fields dynamically without hitting the server with an ajax call.

    These RJS tips may also be helpful.

    0 讨论(0)
  • 2020-12-13 18:59

    RJS is a template (similar to an html.erb file) that generates JavaScript which is executed in an eval block by the browser in response to an AJAX request. It is sometimes used (incorrectly?) to describe the JavaScript, Prototype, and Scriptaculous Helpers provided by Rails.

    0 讨论(0)
提交回复
热议问题