Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Exploring ActiveRecord (Ruby China 2017)
Search
leon
September 24, 2017
Programming
220
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Exploring ActiveRecord (Ruby China 2017)
1. Meatadata: Association; Attribute;
2. ActiveRecord Hierarchies
leon
September 24, 2017
Other Decks in Programming
See All in Programming
Hatena Engineer Seminar #37「言語モデルの活用に関する研究」
slashnephy
0
490
ECSアプリログをFireLensでコスト削減しようとしたけど諦めた話 in Fargate×Node.js
akihisaikeda
2
4.2k
Go1.27で導入されるジェネリクスメソッドでできること
mackee
0
240
AIを活用したE2Eテスト実装効率化のあゆみ / ebisu-mobile-14-kotetu
kotetuco
0
160
Mujeres en SEO Summit 2026 - Greatest Disaster Hits en Web Performance
guaca
0
230
どこまでゆるくて許されるのか
tk3fftk
0
300
Observability in Practice:Grafana 與 Edge Device SRE 的那些事
blueswen
0
190
エンジニア向け会社紹介/Findy Company Profile
findyinc
6
360k
Performance Engineering for Everyone
elenatanasoiu
0
250
正しくソフトウェアを作る、前提を疑うための認知の視点 / doubt-premise
minodriven
21
7.2k
Agentic UI
manfredsteyer
PRO
0
220
エンジニアにデザインハーネスを 〜デザインプロセスを規定するためのハーネス〜 / Design harness from an engineer's perspective
rkaga
2
730
Featured
See All Featured
Bioeconomy Workshop: Dr. Julius Ecuru, Opportunities for a Bioeconomy in West Africa
akademiya2063
PRO
1
170
HTML-Aware ERB: The Path to Reactive Rendering @ RubyCon 2026, Rimini, Italy
marcoroth
2
300
The SEO Collaboration Effect
kristinabergwall1
1
500
Measuring Dark Social's Impact On Conversion and Attribution
stephenakadiri
2
230
From Legacy to Launchpad: Building Startup-Ready Communities
dugsong
0
240
Sam Torres - BigQuery for SEOs
techseoconnect
PRO
0
300
Ruling the World: When Life Gets Gamed
codingconduct
0
270
Stop Working from a Prison Cell
hatefulcrawdad
274
21k
Testing 201, or: Great Expectations
jmmastey
46
8.2k
The AI Revolution Will Not Be Monopolized: How open-source beats economies of scale, even for LLMs
inesmontani
PRO
3
3.5k
Building Applications with DynamoDB
mza
96
7.1k
Highjacked: Video Game Concept Design
rkendrick25
PRO
1
400
Transcript
Confidential Exploring ActiveRecord Leon Confidential
2 Agenda Ø Preface ü Beauty Of Mathematics Ø Metadata
ü Reflection; Association; Attribute Ø Hierarchies ü Scoping Ø Wrapping Up
Introduction
4 FreeWheel是做什么的? 目前90%美国主流电视媒体和运营商使用我们的广告平台。 2014年,我们服务的视频播放超过1250亿次。
5 MRM-FreeWheel的旗舰产品 Monetization Rights Management®
6 FreeWheel的客户
ORM Preface
8 归类 Ø 现有煤气灶、水龙头、水壶和火柴摆在您面前,需要烧水时,须进行如下 操作: ü 往水壶里注满水,点燃煤气,把水壶放到煤气灶上。 Ø 假设现在水壶中的水是满的,其他情况不变,又该怎样去做? ü
物理学家的答案:“点燃煤气,再把水壶放上去。” ü 数学家的答案:“只须把水壶中的水倒掉,问题就化归为前面所说的 问题了。”
9 Ø Hibernate (JAVA) Ø Entity Framework (C#) Ø SQLBoiler
(Golang) Ø Django (Python) Ø ActiveRecord (Ruby)
Real Life Gem
11 Real-life Case: Brand New Copy
12 Tasks Split Up Ø Data Structure: ü Association; Reflection;
Attribute; Graph Ø Algorithm ü Graph copy ü Topology sort ü Priority queue Ø Detail is evil !!
13 ActiveRecord Hierarchies
ActiveRecord Metadata
15 Beauty Of Mathematics
16 Metaphor For Input & Output
17 What's Metadata? - Compiler
18 What's Metadata? - Association
19 Association & Reflection Ø Reflection ü Host; Options Ø
Association: ü Owner ü Reflection ü Target
20
21 Builder & Reflection & Association
22 What's Metadata? - Attribute
23 Attribute Ø Attribute: two dimensions ü Type • data
type; SQL type • casting from/to database type ü Value • Accessor for business model
24
25 Attribute Accessor
ActiveRecord Hierarchies
27 Hierarchies
28 Scoping Ø Scope Ø Relation Ø Scope vs. Relation
Ø Relation vs. Arel
29 Scope
30 Relation
31 Nested Scopes Combined Relation
32 Default Scope Combined Relation
33
Wrapping Up & Abstraction
35 Summary Ø Functionalities ü Metadata Management ü Accessor Methods
Generation ü Scoping && Relation Ø Design ü Meta Programming ü Multiple Layers Design For Single Responsibility ü Interface Over Implementation Ø Program = Data Structure + Algorithm
Confidential THANKS