建议使用活动资源吗?
我从 API 获取数据,并使用 Net::HTTP 向 API 发出请求或向 API 发出请求。我基本上只是从 Net::HTTP 接收数据,然后将其存储在控制器内的实例变量中,然后以 html 形式显示信息。
但我的问题是,我的代码没有像模型这样的结构(我从一个模型执行所有操作:( )或模型关联,应用程序变得越来越大,没有结构,调试起来非常困难。而且很无聊
。另外,应用程序变得越来越慢,我最初的想法是 Net::HTTP 需要时间来执行一些任务,而这些任务在 ActiveRecord/ActiveResource 等库中会更快,
我想开始使用 Active Resource,它看起来是一个不错的图书馆但是我对此不确定,旧视频说它很难调试,并且对于大型 Rails 应用程序来说这是一个禁区。
我的问题是,我应该继续使用 Active Resource 构建这个应用程序吗?为应用程序带来一个结构并使其更快,我们将不胜感激。
I get data from an API, and I use Net::HTTP to do requests from/to the API. I basically just receive data from Net::HTTP then store it in an instance variable inside a controller then display information in html.
But my issue is that, my code doesn't have structure like Models(I perform everything from one model :( ), or Model Associations, the application is getting bigger, with no structure, it's super hard to debug. And boring.
In addition, the application is getting slower, my initial thought is that Net::HTTP takes time to perform some tasks that would be faster in a library like ActiveRecord/ActiveResource.
I want to start using Active Resource, it seems like a good library but I'm unsure about it, old videos say it's hard to debug and it's a no go area for big rails applications.
My question is, should I go ahead and build this application with Active Resource? Or if there are any suggestions to help me bring a structure to the application and make it faster, it would be appreciated. Thank you in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论