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
51
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
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
1k
Serverless Is Ruby Future
ssnickolay
0
870
Anything new Rails 6?
ssnickolay
1
1.4k
Serverless for mere mortals
ssnickolay
1
980
Evolution of Rails application architecture: 14 years in production
ssnickolay
3
1.4k
A Healthy Monolith
ssnickolay
0
1.6k
Elixir. There and Back Again
ssnickolay
0
810
Other Decks in Programming
See All in Programming
Performance Engineering for Everyone
elenatanasoiu
0
220
Oxcを導入して開発体験が向上した話
yug1224
4
340
過去最大のMCPアップデート! 2026-07-28 RC版の謎に迫る
licux
6
390
なぜ型を書くのか? TSKaigi2026で改めて考える #tskaigi_smarthr
kajitack
0
150
LaravelLive Japan の裏方のすべて — 第188回 PHP勉強会@東京 (2026-06-24)
suguruooki
2
120
IBM Bobを活用したレガシーアプリの最新化
oniak3ibm
PRO
1
210
Vite+ Unified Toolchain for the Web
naokihaba
0
340
技術的負債解消で開発者の未来を開く- AIの力でコード刷新
kmd2kmd
0
120
Make SRE Operations Easier with Azure SRE Agent
kkamegawa
0
8k
TypeScript+Orvalで実現する型安全かつ堅牢でスケーラブルなマルチチャネル通知基盤 / TSKaigi Night talks ~after conference~
d0riven
0
360
Skillsは効率化、Agentsは"自分の拡張"——Builder時代のエージェント編成(CC Night 2026)
wemra
1
160
ローカルLLMを使ってB2Bサービスを作っていての学び
yaotti
0
210
Featured
See All Featured
Test your architecture with Archunit
thirion
1
2.3k
The Art of Programming - Codeland 2020
erikaheidi
57
14k
Design of three-dimensional binary manipulators for pick-and-place task avoiding obstacles (IECON2024)
konakalab
0
470
What the history of the web can teach us about the future of AI
inesmontani
PRO
1
620
Lightning talk: Run Django tests with GitHub Actions
sabderemane
0
200
The B2B funnel & how to create a winning content strategy
katarinadahlin
PRO
1
400
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
162
16k
The Cost Of JavaScript in 2023
addyosmani
55
10k
How GitHub (no longer) Works
holman
316
150k
Reality Check: Gamification 10 Years Later
codingconduct
0
2.2k
Producing Creativity
orderedlist
PRO
348
40k
Building a Modern Day E-commerce SEO Strategy
aleyda
45
9.1k
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 • …