Ruby on Rails activity record overview

Source: Internet
Author: User
Tags ruby on rails

Writing a database management system with Ruby on Rails is very fast. Ruby on Rails has such a high productivity, not only is Ruby's syntax flexible, but it's all a big program thanks to activity records (active record). So what is an activity record? If you explain it in one sentence, it's a framework that maps data to objects (somewhat like hibernate). Perhaps you would say: "What is this, now that the framework is many, hibernate is not also very strong?" "But if you use Ruby on Rails (hereinafter referred to as ROR), you'll find how different it is from the other frameworks, easier to use than other frameworks, and more efficient in programming, according to officials, Using Ror is 10 times times more productive than using Java and hibernate (perhaps not so exaggerated, but the data maps of active records are certainly more productive than the data maps of other frameworks).

Data processing is always at the core of both desktop and web-based programs. The data can be described and processed using different techniques.

One of these data processing techniques is object-relational mapping technology, or ORM technology. ORM Technology maps a data table or view in a database to a class of surface objects. The role of ORM Framework is to bridge the data and objects, and to provide the corresponding service for the data and objects at both ends of the bridge. Because the ORM framework is self-contained, the main task for developers is to connect the ORM framework with other frameworks, such as the web framework, so that they can work together.

In the ORM Framework family, ROR is very special. The core of ROR is the ORM framework, which is expressed in the form of activity records in ROR. In this article, we will focus on some of the basic concepts of activity records and her most tempting places: fast connection and manipulation of databases. The first part of this article discusses the basics of the activity record. The second part is a step-by-step guide to how you can quickly connect and manipulate databases using active records. In Part three we discuss how to use activity records with Actioncontroller and Actionview in a complete example. The above is the main content discussed in this article.

What is an activity record

The activity record is an ORM framework, or it can be seen as a database mapping layer that is published with Ror. Activity record is the core of ROR. The activity record is an ORM layer that provides the following mapping services:

1. Mapping a table into a class

2. Mapping fields to properties of a class

3. Mapping primary keys in the table to IDs properties

4. Mapping Rows to Objects

The biggest difference between active records and other ORM frameworks is that they are mapped differently. Most popular ORM frameworks (such as hibernate) are XML as a mapping container. The active record is mapped using a "convention" approach that is easier to use. Let's take a look at how the activity record is done.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.