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
Rails 6: ActiveRecord
Search
Nikolay Sverchkov
November 30, 2019
Programming
46
0
Share
Rails 6: ActiveRecord
Nikolay Sverchkov
November 30, 2019
More Decks by Nikolay Sverchkov
See All by Nikolay Sverchkov
Authorization in the GraphQL era
ssnickolay
0
990
Serverless Is Ruby Future
ssnickolay
0
830
Anything new Rails 6?
ssnickolay
1
1.4k
Serverless for mere mortals
ssnickolay
1
960
Evolution of Rails application architecture: 14 years in production
ssnickolay
3
1.4k
A Healthy Monolith
ssnickolay
0
1.5k
Elixir. There and Back Again
ssnickolay
0
780
Other Decks in Programming
See All in Programming
PicoRuby for IoT: Connecting to the Cloud with MQTT
yuuu
2
780
Cloudflare で始める Data Platform
ta93abe
0
170
AI時代になぜ書くのか
mutsumix
0
410
リセットCSSを1行消したらアクセシビリティが向上した話
pvcresin
4
520
2026年のソフトウェア開発を考える(2026/05版) / Software Engineering Scrum Fest Niigata 2026 Edition
twada
PRO
23
13k
KMP × Kotlin 2.3 - How Android Got Slower While iOS Builds Improved by 47%
rio432
0
200
決定論 vs 確率論:Gemini 3 FlashとTF-IDFを組み合わせた「法規判定エンジン」の構築
shukob
0
160
My daily life on Ruby
a_matsuda
3
400
新規プロダクトを高速で生み出すハーネスエンジニアリング
seanchas116
2
140
Augmenting AI with the Power of Jakarta EE
ivargrimstad
0
490
関係性から理解する"同一性"の型用語たち
pvcresin
1
150
ハーネスエンジニアリングにどう向き合うか 〜ルールファイルを超えて開発プロセスを設計する〜 / How to approach harness engineering
rkaga
28
23k
Featured
See All Featured
The Spectacular Lies of Maps
axbom
PRO
1
750
The AI Search Optimization Roadmap by Aleyda Solis
aleyda
1
5.8k
Avoiding the “Bad Training, Faster” Trap in the Age of AI
tmiket
0
150
The Illustrated Guide to Node.js - THAT Conference 2024
reverentgeek
1
350
Have SEOs Ruined the Internet? - User Awareness of SEO in 2025
akashhashmi
0
340
A Tale of Four Properties
chriscoyier
163
24k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
194
17k
Speed Design
sergeychernyshev
33
1.7k
Groundhog Day: Seeking Process in Gaming for Health
codingconduct
0
180
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
55
3.3k
Rails Girls Zürich Keynote
gr2m
96
14k
Lightning talk: Run Django tests with GitHub Actions
sabderemane
0
180
Transcript
NIKOLAY SVERCHKOV @ssnickolay ACTIVE RECORD 6+
#saintprubyconf @ssnickolay
@ssnickolay RAILS 6.0 MULTIPLE DATABASE SUPPORT
@ssnickolay gem ‘octopus’
@ssnickolay gem ‘octopus’ FOCUSED ON
@ssnickolay RAILS 6.0: MULTI DB MULTI DB = DB SHARDING
= + + + VERTICAL OR HORIZONTAL PARTITIONING / REPLICATION
@ssnickolay RAILS 6.0: MULTI DB RAILS DID NOT HAVE ADEQUATE*
MULTI DB SUPPORT *https://github.com/ankane/multiverse
@ssnickolay RAILS 6.0: MULTI DB MULTI DB !!= DATABASE SHARDING
@ssnickolay AT LEAST 12 HUGE PRS FROM @EILEENCODES RAILS 6.0:
MULTI DB
WHEN YOU RELEASE THE NEW FEATURE
@ssnickolay RAILS 6.0: MULTI DB MULTI DB !!= DATABASE SHARDING
?
@ssnickolay RAILS 6.0: MULTI DB MULTI DB !!= DATABASE SHARDING
@ssnickolay RAILS 6.0: BULK INSERTS # Insert multiple records, performing
an upsert # when records have duplicate ISBNs Book.upsert_all([ { title: 'Rework', author: 'David', isbn: '1' }, { title: 'Eloquent Ruby', author: 'Russ', isbn: '1' } ], unique_by: { columns: %w[ isbn ] }) *gem ‘activerecord-import`
@ssnickolay RAILS 6.0: update Rails 4.0.2 update_attributes(column: value) update(column: value)
Rails 6+ update(column: value) Deprecate `update_attributes`
@ssnickolay RAILS 6.0: update Rails 4.0.2 update_attributes(column: value) update(column: value)
Rails 6+ update(column: value) Deprecate `update_attributes`
@ssnickolay RAILS 6.0: create_or_find_by find_or_create_by vs create_or_find_by
@ssnickolay find_or_create_by def find_or_create_by!(attributes, &block) find_by(attributes) !|| create!(attributes, &block) end
@ssnickolay find_or_create_by def find_or_create_by!(attributes, &block) find_by(attributes) !|| <Вот-Тут-> create!(attributes, &block)
end
@ssnickolay RAILS 6.0: create_or_find_by def create_or_find_by(attributes, &block) transaction(requires_new: true) {
create(attributes, &block) } rescue ActiveRecord!::RecordNotUnique find_by!(attributes) end
@ssnickolay RAILS 6.0: create_or_find_by def create_or_find_by(attributes, &block) transaction(requires_new: true) {
create(attributes, &block) } rescue ActiveRecord!::RecordNotUnique <Вот-Тут-> find_by!(attributes) end
@ssnickolay RAILS 6.0: Other • Make t.timestamps with precision by
default • Add support for UNLOGGED Postgresql tables • Add support for annotating queries generated by ActiveRecord::Relation with SQL comments • Make it possible to override the implicit order column • …