1. HTTP: Hyper Text Transfer Protocol
Hypertext: 可以代表link,超链接。
transfer: 把hypertext 来回传递。
Protocol: 有一定的传递规则。
transfer: request and responseHTTP REQUEST1. action: get/po …

1. what are AR associations?

In Rails, an association is a connection between two Active Record models. Associations make common operations simpler and easier in your code.class Movie < ApplicationRecord
has_many :actors
end
has_many is a typical AR association. The common associations are has_one, has_many, belongs_to, has_one_through, has_many_through...

2. Understanding associations in a SQL perspective

what does the association do in…

Learning Objectives

  • Explain the basics of an HTTP request-response cycle
  • Explain how the request-response cycle works with respect to Rails & MVC
  • Explain what a RESTful API is
  • Build Rails Routes, Controllers & Actions corresponding to the 7 RESTful routes

What is a server?

  • The term ‘server’ is used to refer…

Learning Objectives

  • Define metaprogramming
  • Identify self in:
  • class definitions
  • class methods
  • instance methods
  • Describe the difference between class variables and class instance variables
  • Know how to use send and define_method (and method_missing if time allows) ********这个是重点。

Agenda

  • What is metaprogramming? 用program来创建program

What is Metaprogramming?

  • What is programming?
  • The essence of programming…

Learning Objectives

  • Understand how powerful active record is
  • AR是什么?一个rails的built-in ORM to manipulate the database, 本质是一个Class, 作用就是以OOP的形式来query database。
  • Understanding its limitations
  • How to avoid N+1 queries,直接通过includes调取连接数据,避免多次query 数据库。
  • Recognizing we don’t need to memorize everything

ActiveRecord Querying vs SQL

  • Ruby interface for querying database
  • Mirrors SQl queries
  • Pros: less overall database access code, more convenient

Rails: A server-side MVC web-application framework

  • ****full stack framework*****

ActiveRecord - an ORM Framework (The M in MVC)

Learning Goals

  • Understand why we need databases
  • 存取数据,数据保存ACID, atomic/consistent/independent/durable
  • Explain “Relational DataBase Management System”
  • 类似mysql,Postgresql这种数据库管理软件
  • Be able to access data in a database and perform basic operations on the data
  • select from where a=b
  • select from (select from)
  • select name, count* from table group by 1
  • select name…

Yizhe Wang

Designer transforming into a developer

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store