`
jiajie0531
  • 浏览: 27810 次
  • 性别: Icon_minigender_1
  • 来自: 上海
社区版块
存档分类
最新评论

Active Record Basics 1 What is Active Record?

阅读更多

version: rails 4

 

概要

 

  • ORM和Active Record是什么?以及他们在Rails中是怎样使用的?
  • Active Record如何融入到MVC框架中?
  • 如何使用Active Record模型在关系型数据库中来操作数据的存储?
  • Active Record模式命名的规则。
  • 数据库迁移,验证和回滚的概念。

 

1 What is Active Record?

什么是Active Record?

 

Active Record 是MVC中的M—模型,它是系统的一个层,主要职责是实现业务数据和逻辑。Active Record用来对业务对象的创建和使用,它的数据需要持久性地存储至数据库中。Active Record模式的一种实现方式可以这样来描述,它是一个ORM对象关系映射系统。

 

1.1 The Active Record Pattern

Active Record模式

 

Active Record was described by Martin Fowler 在他的书《企业应用架构模式》中。在Active Record中,对象拥有持久性数据和行为,其行为就是操作数据。 Active Record觉得受保护的数据存储逻辑是对象的一部分,将会让用户学习到对于那个对象如何从数据库中去写入和读取。

 

1.2 Object Relational Mapping

对象关系映射

 

通常简写为ORM,对象关系映射,ORM是一个技术,它联系应用程序的富对象与关系数据库系统中的数据表。使用ORM,在一个应用程序中对象的属性和关联性能够被简单地从数据库中保存和获取,而不需要直接写SQL语句,以及较少的数据库存取代码。

 

1.3 Active Record as an ORM Framework

Active Record 是作为一个ORM的框架

 

Active Record给我们提供了一些机制,下面是最重要的特征:

  • 描述models和他们的数据。
  • 描述这些models之间的关联性。
  • 描述这些相关联的models之间的继承关系。
  • 在models被持久性地保存到数据库之前,验证models。
  • 以面向对象的方式执行数据库操作。

 

 

 

original text: http://guides.rubyonrails.org/active_record_basics.html

0
0
分享到:
评论

相关推荐

    Deep Learning, Vol. 1: From Basics to Practice

    1: From Basics to Practice By 作者: Andrew Glassner Pub Date: 2018 ISBN: n/a Pages: (909 of 1750) Language: English Format: PDF People are using the tools of deep learning to change how we think ...

    Active Directory Cookbook, 3rd Edition.pdf

    Covers the basics of searching Active Directory: creating, modifying, and deleting objects, using LDAP controls, and importing and exporting data using LDAP Data Interchange Format (LDIF) and comma-...

    Pro ActiveRecord Databases

    And almost all of those books actually do a great job of introducing you to the basics of Active Record; they go a long way toward getting you started with the library. However, because they ...

    ffmpeg basics

    ffmpeg basics ffmpeg basics ffmpeg basics ffmpeg basics ffmpeg basics

    MongoDB Basics

    Developers and relational database admins who need to get up to speed quickly on what MongoDB is, how it works, and how to use it. Table of Contents Ch. 1: Introduction to MongoDB Ch. 2: Installing ...

    Basics Of Trading Systems

    This tutorial addresses these questions and defines what a trading system is, and what it takes to design and implement one. If you are thinking of adopting a trading system, this is the place to ...

    Rails Crash Course(No Starch, 2014)

    In Part II, you'll take your skills to the next level as you build a social networking app with more advanced Ruby tools, such as modules ...advanced data modeling techniques within Rails's Active Record....

    Python Basics with Numpy

    Python Basics with Numpy Python Basics with Numpy Python Basics with Numpy

    Deep Learning, Vol. 2: From Basics to Practice

    Our goal is to give you all the basics you need to understand deep learning, and then show how to use those ideas to construct your own systems. Everything is covered from the ground up, culminating ...

    HTML Basics

    Welcome to HTML Basics. This workshop leads you through the basics of Hyper Text Markup Language (HTML). HTML is the building block for web pages. You will learn to use HTML to author an HTML page to ...

    MPLS Basics MPLS Basics

    MPLS BasicsMPLS Basics

    FFmpeg Basics

    FFmpeg Basics

    Android.Programming.The.Easy.Way

    What is Android Development? Basics of Development What is XML What is Java What is the Development Environment Eclipse Android Studio Setting up PATH for Windows and Mac OSX Creating a Project Coding...

    Basics for EDI

    This is the Basics for EDI. EDI is hot in nowadays.

    Blockchain Basics: A Non-Technical Introduction in 25 Steps

    Why it is needed and what problem it solves Why there is so much excitement about the blockchain and its potential Major components and their purpose How various components of the blockchain work and ...

    Stepper Motor Basics

    Stepper Motor Basics

    Blockchain.Basics.A.Non-Technical.Introduction.in.25.Steps.pdf

    In 25 concise steps, you will learn the basics of blockchain technology. No mathematical formulas, program code, or computer science jargon are used. No previous knowledge in computer science, ...

    英文原版-The Basics of Process Improvement 1st Edition

    Unlikeother books that promote a specific process and performance improvement discipline, this book shows organizations how to achieve success by fixing basic operational issues and problems using a ...

    LabWindows CVI BASICS I & II

    LabWindows CVI BASICS I & II 英文版的都是

    FFmpeg Basics = 119.pdf

    FFmpeg Basics = 119.pdf

Global site tag (gtag.js) - Google Analytics