Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Exploring ActiveRecord (Ruby China 2017)
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
leon
September 24, 2017
Programming
240
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
Transcript
36 slides
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
Other Decks in Programming
See All in Programming
Next.js: The final boss of Web Performance
guaca
0
400
複数ドメインを一つのアプリに統合するFlutterの設計と運用_FlutterKaigi2026登壇資料(須永高弘)
takahirosunaga
0
170
Vapor Mode でアクセシビリティは 壊れないか検証した話
fuqda
1
340
プロジェクトコードをキレイキレイしよう!暗黙的な参照を読み解く静的解析
ostk0069
0
210
Snowflake Openflow Connector利用の勘所 / 20261024developersio2026tokyo-snowflake-openflow
kasacchiful
PRO
0
330
現場と育てるRailsモデリング 〜Spreadsheetから始めたモデル設計〜
siroemk
2
1.2k
TanStack Vue Query と Pinia Colada から学ぶ非同期状態の型設計
aoshi
0
650
小さなアプリを作って公開するまで
onozaty
0
160
TS 7.0 で baseUrl が使えなくなった今、パスエイリアスをどうするか
bicstone
2
600
Будущее локальных LLM – Алексей Голобурдин, PythoNN
sobolevn
0
120
ActionController meets Protocol Buffers
sorah
1
800
React Native経験者が Flutterを30⽇間触って驚いたこと
3saito
0
170
Featured
See All Featured
Rails Girls Zürich Keynote
gr2m
96
14k
Principles of Awesome APIs and How to Build Them.
keavy
128
18k
Digital Ethics as a Driver of Design Innovation
axbom
PRO
2
520
DevOps and Value Stream Thinking: Enabling flow, efficiency and business value
helenjbeal
2
440
What does AI have to do with Human Rights?
axbom
PRO
1
2.5k
How To Stay Up To Date on Web Technology
chriscoyier
790
250k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
25
2.2k
SEOcharity - Dark patterns in SEO and UX: How to avoid them and build a more ethical web
sarafernandez
0
330
[RailsConf 2023] Rails as a piece of cake
palkan
59
7.1k
Chasing Engaging Ingredients in Design
codingconduct
0
390
More Than Pixels: Becoming A User Experience Designer
marktimemedia
3
620
AI: The stuff that nobody shows you
jnunemaker
PRO
11
1.3k