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
Rails 6: ActiveRecord
Search
Nikolay Sverchkov
November 30, 2019
Programming
56
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
1.2k
Serverless Is Ruby Future
ssnickolay
0
960
Anything new Rails 6?
ssnickolay
1
1.6k
Serverless for mere mortals
ssnickolay
1
1.1k
Evolution of Rails application architecture: 14 years in production
ssnickolay
3
1.5k
A Healthy Monolith
ssnickolay
0
1.7k
Elixir. There and Back Again
ssnickolay
0
920
Other Decks in Programming
See All in Programming
気持ちぃ〜角丸 Squircle
ryu1013
0
340
AI時代のTerminal環境を UNIX哲学で設計・運用する
yasunori0418
1
210
自サークルのIdPからログアウトできるようになるまで
taiseiue
1
150
[JA] Domain Modeling with Vanilla Rails: 「操作」から再考するRailsの設計論
yasaichi
4
930
GraphQL の onError と Nullability のこれから
quramy
0
180
現場と育てるRailsモデリング 〜Spreadsheetから始めたモデル設計〜
siroemk
2
950
個人開発者よ、Honoを使え(おじさんver)
tanahiro2010
2
280
Groovy as a human and AI friendly programming language
paulk
0
110
Unity6 URPによる海底をテーマにしたVJシステムの解説 | Unity Shader 完全に理解した 勉強会
gam0022
0
380
SFCで実現する病院・医療システムの動的組み立て式UI
koukimiura
1
110
Inertia Rails: The One-Person Framework with React & Friends
skryukov
0
120
Vapor Mode でアクセシビリティは 壊れないか検証した話
fuqda
1
120
Featured
See All Featured
Done Done
chrislema
187
17k
Keith and Marios Guide to Fast Websites
keithpitt
413
23k
Design in an AI World
tapps
1
360
brightonSEO & MeasureFest 2025 - Winning Strategies for Black Friday CRO & PPC - Christian Goodrich
cargoodrich
3
880
How to Align SEO within the Product Triangle To Get Buy-In & Support - #RIMC
aleyda
2
1.8k
16th Malabo Montpellier Forum Presentation
akademiya2063
PRO
0
420
Lightning talk: Run Django tests with GitHub Actions
sabderemane
0
300
The Illustrated Children's Guide to Kubernetes
chrisshort
51
53k
So, you think you're a good person
axbom
PRO
2
2.2k
More Than Pixels: Becoming A User Experience Designer
marktimemedia
3
580
Code Reviewing Like a Champion
maltzj
529
40k
Efficient Content Optimization with Google Search Console & Apps Script
katarinadahlin
PRO
1
940
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 • …