智能化下的产物,无人棋牌室
Rails 5.0.0 发布了。
Rails 是一个用于开发数据库驱动的网络应用程序的完整框架。Rails基于MVC(模型- 视图- 控制器)设计模式。从视图中的Ajax应用,到控制器中的访问请求和反馈,到封装数据库的模型,Rails 为你提供一个纯Ruby的开发环境。发布网站时,你只需要一个数据库和一个网络服务器即可。
主要更新内容:
Action Cable
- Action Cable是Rails处理WebSocket的全新框架。这是一个完全集成的连接管理解决方案,服务器端处理的通道层和客户端交互的JavaScript层。它非常容易使用,并使功能充满设计感,如聊天,通知和 Presence 都变得容易很多。
API mode
- 如果您使用rails new backend –api,创建一个新的Rails应用程序,你会得到一个精简的skeleton和配置。假设你会使用JSON,不是HTML。默认情况下,API mode 只是依赖于于模型类的#to_json# calls ,但是你可以使用JBuilder, Active Model Serializers,或看看新JSONAPI::Resources project来找到更先进的解决方案。
其他高亮
- One Rails Command instead of the split-brain setup between rake and rails, so now it’s
bin/rails db:migrate
instead ofbin/rake db:migrate
(herding by Kasper Timm Hansen). - New Attributes API by Sean Griffin.
- The test runner now reports failures inline, so you don’t have to complete the suite to see what went wrong.
- ApplicationRecord has been born as a default parent class of all models created by the generators.
- ActiveRecord::Relation#in_batches makes it much easier to deal with record work in batches at a time to lessen memory overloads.
- Post.where(‘id = 1’).or(Post.where(‘id = 2’)) gives you exactly what you’d think!
- No more accidentally halting Active Record callbacks because the last statement is false. Now you throw(:abort) explicitly!
需要关注的更新日志:
- Action Mailer CHANGELOG
- Action Pack CHANGELOG
- Action View CHANGELOG
- Active Model CHANGELOG
- Active Record CHANGELOG
- Active Support CHANGELOG
- Active Job CHANGELOG
- Railties CHANGELOG
详情:Rails 5.0: Action Cable, API mode, and so much more