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
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
Nikolay Sverchkov
November 30, 2019
Programming
0
46
Rails 6: ActiveRecord
Nikolay Sverchkov
November 30, 2019
Tweet
Share
More Decks by Nikolay Sverchkov
See All by Nikolay Sverchkov
Authorization in the GraphQL era
ssnickolay
0
920
Serverless Is Ruby Future
ssnickolay
0
790
Anything new Rails 6?
ssnickolay
1
1.4k
Serverless for mere mortals
ssnickolay
1
920
Evolution of Rails application architecture: 14 years in production
ssnickolay
3
1.3k
A Healthy Monolith
ssnickolay
0
1.4k
Elixir. There and Back Again
ssnickolay
0
740
Other Decks in Programming
See All in Programming
DevinとClaude Code、SREの現場で使い倒してみた件
karia
1
1.1k
CSC307 Lecture 15
javiergs
PRO
0
260
Angular-Apps smarter machen mit Gen AI: Lokal und offlinefähig - Hands-on Workshop!
christianliebel
PRO
0
130
生成 AI 時代のスナップショットテストってやつを見せてあげますよ(α版)
ojun9
0
300
コードレビューをしない選択 #でぃーぷらすトウキョウ
kajitack
3
1.1k
存在論的プログラミング: 時間と存在を記述する
koriym
4
470
Nostalgia Meets Technology: Super Mario with TypeScript
manfredsteyer
PRO
0
110
Reactive ❤️ Loom: A Forbidden Love Story
franz1981
2
160
Pythonデータ分析コトハジメinFukuoka
kanan
0
100
Migration to Signals, Signal Forms, Resource API, and NgRx Signal Store @Angular Days 03/2026 Munich
manfredsteyer
PRO
0
150
車輪の再発明をしよう!PHP で実装して学ぶ、Web サーバーの仕組みと HTTP の正体
h1r0
2
380
ふつうの Rubyist、ちいさなデバイス、大きな一年
bash0c7
0
1.1k
Featured
See All Featured
How STYLIGHT went responsive
nonsquared
100
6k
How To Speak Unicorn (iThemes Webinar)
marktimemedia
1
410
Unlocking the hidden potential of vector embeddings in international SEO
frankvandijk
0
210
How to Talk to Developers About Accessibility
jct
2
160
Accessibility Awareness
sabderemane
0
84
Code Reviewing Like a Champion
maltzj
528
40k
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
31
3.1k
The Art of Programming - Codeland 2020
erikaheidi
57
14k
Building Applications with DynamoDB
mza
96
7k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
249
1.3M
Leveraging LLMs for student feedback in introductory data science courses - posit::conf(2025)
minecr
1
210
What Being in a Rock Band Can Teach Us About Real World SEO
427marketing
0
200
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 • …