Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to develop High quality Web applications based on Ruby On Rails

2025-04-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly analyzes the relevant knowledge points of how to develop high-quality Web applications based on Ruby On Rails, the content is detailed and easy to understand, the operation details are reasonable, and has a certain reference value. If you are interested, you might as well follow the editor and learn more about how to develop high-quality Web applications based on Ruby On Rails.

More and more enterprises begin to choose Ruby On Rails as the framework for Web development, and Rails used to be the choice of some "lightweight companies". Rails was chosen because of its ability to build at high speed, and because it is a DSL developed by Web. So choosing Rails represents "efficient development"? What factors affect the quality of Web applications?

MVC

We all know that Rails is a MVC-structured Web framework, and the responsibilities of the various parts of MVC are clear. But the question is whether we can really follow the MVC architecture to achieve a clear separation of local responsibilities? Can you follow the yardstick of a single responsibility?

Within most of the code, this form of chaos exists between model and controller: controller takes on too many responsibilities that should have been assumed by model. A typical example is an embedded (multiple) object form. For example, there is an one-to-many relationship between Album and Photo, and we want to create an album with multiple photo. Before Rails 2.3, we could write something like this:

AlbumsController def create album = Album.new params [: album] album.photos "Are you sure?"% >

Before Rails 3, the code it generated should be (the code was omitted):

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report