简体   繁体   中英

What is the Current State of the Art in AJAX + Rails?

I was quite surprised to read about RJS in Rails 3. Is this the way most rails sites work with AJAX?

And if I'm working with Backbone (and this is a good example), won't it have conflicts with ujs?

Rjs is easy to use but is not the proper way to deal with Ajax. Rails developers know that; all the more, RJS should be extracted to a gem. Yep, sever side js is not that scalable.

Backbone has been developed with Rails backend, and it's philosophy is a bit inspired from the framework. So you won't have any problems: it has been extensively tested.

Speaking about Backbone and Rails, I suggest you use the backbone-rails gem ( my fork handles better the delete method but hasn't been merged yet).

Don't know about "most", but for some things, it's way easier than the alternatives (storing stuff in DOM, etc.) Would it conflict with Backbone? Dunno, but if you're using Backbone, what would you be using RJS for (except for non-Backboney parts, if any)? If you're using Backbone wouldn't you just use the Rails JSON bits?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM