简体   繁体   English

摆脱Rails的障碍?

[英]Getting Rails out of the way?

I have a legacy app that was built entirely in jQuery and HTML. 我有一个完全使用jQuery和HTML构建的旧版应用程序。 Does a lot AJAX calls and so forth. 进行很多AJAX调用等等。

I needed an authentication framework for it, so I wrapped it in a Rails app. 我需要一个身份验证框架,因此将其包装在Rails应用程序中。

Rails -> does the authentication jQuery/HTML -> all the rest Rails->执行身份验证jQuery / HTML->所有其他

The problem is that the jQuery stuff doesn't seem to work anymore. 问题在于jQuery的东西似乎不再起作用。 All my regular AJAX calls get nothing back from the server. 我所有的常规AJAX调用都无法从服务器获得任何回报。

Does Rails interfere with normal AJAX calls? Rails是否会干扰正常的AJAX调用? Is there a way to get it out of the way? 有没有办法摆脱它? ie I want to do the authentication, then hand off to the jQuery app and not have any interference. 即我想进行身份验证,然后移交给jQuery应用,并且不会受到任何干扰。

I don't have the time or patience to turn it into a true Rails app. 我没有时间或耐心将它变成一个真正的Rails应用程序。

(Or is there a better way to do this? I looked at some jQuery/Javascript authentication, but couldn't get my head around it) (或者有更好的方法吗?我看过一些jQuery / Java身份验证,但无法解决)

Sounds like you don't really want to use Rails. 听起来好像您真的不想使用Rails。 Rails is meant to be a full application framework, and as such will most certainly 'get in your way'. Rails是一个完整的应用程序框架,因此肯定会“妨碍您”。

I'd suggest a simpler framework, something like Sinatra: http://www.sinatrarb.com/ 我建议使用一个更简单的框架,例如Sinatra: http : //www.sinatrarb.com/

我认为此链接上的视频将帮助您: 如何将jQuery与Rails结合使用?

The issue is that Rails automatically includes the prototype javascript library which gets in the way of jQuery. 问题是Rails自动包含原型javascript库,该库会妨碍jQuery。 A quick solution may be to use jRails which should replace those protoype calls with jquery ones. 一个快速的解决方案可能是使用jRails ,它应该将那些原型调用替换为jquery调用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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