Lock in $30 Savings on PRO—Offer Ends Soon! ⏳
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Rails 6: ActiveRecord
Search
Nikolay Sverchkov
November 30, 2019
Programming
0
44
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
860
Serverless Is Ruby Future
ssnickolay
0
750
Anything new Rails 6?
ssnickolay
1
1.3k
Serverless for mere mortals
ssnickolay
1
880
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
700
Other Decks in Programming
See All in Programming
Java 25, Nuevas características
czelabueno
0
110
tparseでgo testの出力を見やすくする
utgwkk
2
280
The Art of Re-Architecture - Droidcon India 2025
siddroid
0
120
フルサイクルエンジニアリングをAI Agentで全自動化したい 〜構想と現在地〜
kamina_zzz
0
280
TestingOsaka6_Ozono
o3
0
170
ゆくKotlin くるRust
exoego
1
160
生成AIを利用するだけでなく、投資できる組織へ
pospome
2
400
AIコーディングエージェント(skywork)
kondai24
0
200
メルカリのリーダビリティチームが取り組む、AI時代のスケーラブルな品質文化
cloverrose
2
360
実は歴史的なアップデートだと思う AWS Interconnect - multicloud
maroon1st
0
260
perlをWebAssembly上で動かすと何が嬉しいの??? / Where does Perl-on-Wasm actually make sense?
mackee
0
120
re:Invent 2025 のイケてるサービスを紹介する
maroon1st
0
150
Featured
See All Featured
Art, The Web, and Tiny UX
lynnandtonic
304
21k
Getting science done with accelerated Python computing platforms
jacobtomlinson
0
76
BBQ
matthewcrist
89
9.9k
Bash Introduction
62gerente
615
210k
Why You Should Never Use an ORM
jnunemaker
PRO
61
9.7k
The browser strikes back
jonoalderson
0
120
Balancing Empowerment & Direction
lara
5
820
How to make the Groovebox
asonas
2
1.8k
Joys of Absence: A Defence of Solitary Play
codingconduct
1
260
Tips & Tricks on How to Get Your First Job In Tech
honzajavorek
0
400
AI: The stuff that nobody shows you
jnunemaker
PRO
1
15
Crafting Experiences
bethany
0
22
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 • …