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のための負債の減らし方
Search
alpaca-tc
September 27, 2016
0
390
Railsのための負債の減らし方
alpaca-tc
September 27, 2016
Tweet
Share
More Decks by alpaca-tc
See All by alpaca-tc
TracePointを活用してモデル名変更の負債解消をした話
alpacatc
2
1.4k
Railsのモデル名をすべて変更した話
alpacatc
0
390
新規サービス立ち上げを経て気づいたマネーフォワードの文化
alpacatc
0
1.5k
Attributes API 実践
alpacatc
4
1.9k
Mastodonを3倍早くしたい話
alpacatc
0
2.8k
AdminScriptで管理画面をスッキリさせる
alpacatc
3
610
[pixiv summer boot camp] pixivFACTORY
alpacatc
0
3.5k
Featured
See All Featured
Reflections from 52 weeks, 52 projects
jeffersonlam
347
20k
The Straight Up "How To Draw Better" Workshop
denniskardys
232
140k
Agile that works and the tools we love
rasmusluckow
328
21k
How GitHub (no longer) Works
holman
311
140k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
38
1.9k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
28
900
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
251
21k
StorybookのUI Testing Handbookを読んだ
zakiyama
27
5.3k
Building Better People: How to give real-time feedback that sticks.
wjessup
365
19k
How STYLIGHT went responsive
nonsquared
95
5.2k
Java REST API Framework Comparison - PWX 2021
mraible
PRO
28
8.3k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
330
21k
Transcript
RailsͷͨΊͷ ෛ࠴ͷݮΒ͠ํ @alpaca-tc
ࣗݾհ
@alpaca-tc @alpaca_tc ❤ Vim, Ruby, ͍ͬ͘Μ@pixiv
ͷͮ͘Γ͕ͬͱָ͘͠ͳΔΞΠςϜ࡞αʔϏε pixivFACTORY ը૾1ຕ͔Β 40छͷ άοζɾಉਓࢽ ॳظඅ༻0 ΦϯσϚϯυൢച 2015.02.05-
ͷͮ͘Γ͕ͬͱָ͘͠ͳΔΞΠςϜ࡞αʔϏε pixivFACTORY Rails 2015.02.05- JavaScript Go Blender Controllers 93 ϑΝΠϧ
Models 304 ϑΝΠϧ table 70+
ࠓே
None
None
ෛ࠴͕େ͖͍΄Ͳฦࡁ͕େม
ෛ࠴͕େ͖͍΄Ͳฦࡁ͕େม ෛ࠴খ·Ίʹฦ͢ํ͕ྑ͍
Θ͔Δ
None
RailsͷΞοϓάϨʔυ
খ·Ίʹෛ࠴ΛݮΒͯ͠ ָʹRailsΞοϓσʔτ
ෛ࠴ΛݮΒ͢3ͭͷίπ
1. ίʔυΛॻ͔ͳ͍
ίʔυ͕গͳ͍΄Ͳ ΞοϓσʔτָʹͳΔ
YAGNI You Ain’t Gonna Need It
ػೳඞཁʹͳΔ·ͰՃ͠ͳ͍ ʮίʔυΛૉૣ࣮͘͢ΔͨΊ ͷ࠷ྑ͍ํ๏ɺ͋·Γίʔ υΛॻ͔ͳ͍͜ͱʯ
ෆཁʹͳͬͨίʔυ ΨϯΨϯফ͍ͯ͘͠
Rails Way CoC / DRY
”Կ͔Λͳ͢͏͑Ͱ࠷ળͷํ๏ͱ ͍͏ͷ͕1͚ͭͩ͋Δ” कΕίʔυখ͘͞ͳΔ
2. Ξοϓσʔτখ·Ίʹ
Ͱ͢
Rails 5 dateΧϥϜʹɺҰ෦ۭനͷΛpost͢Δ Ͳ͏ͳΔͰ͠ΐ͏ʁ record.update(params.permit(:date))
record.update(params.permit(:date)) NoMethodError: undefined method `in_time_zone' for 0:Fixnum
ීஈ͔Βɺߋ৽Λࡉ͔͘backport͢Δ config/initializers/rails51_backport.rb backport͢Δ 5.0-stableόά͍ͬͯΔɻ(#25834, #25146, #25364…etc) ৽ػೳ͍ΕΔͱόʔδϣϯΞοϓָ͕ (#25991ͳͲ) ʮThis Week
in RailsʯͷRSSʹྲྀΕͨมߋΛ খ·ΊʹೖΕΔͱྑ͍
3. ةͳ͍ίʔυΛݕ
if Rails.gem_version >= Gem::Version.new('5.0.0') ActiveSupport::Deprecation.warn('廃止予定') raise('要チェック') ίʔυʹຒΊࠐΉ
if Rails.gem_version >= Gem::Version.new('5.0.0') ActiveSupport::Deprecation.warn('廃止予定') raise('要チェック') ίʔυʹຒΊࠐΉ ɾRailsΛϋοΫ͍ͯ͠ΔՕॴ ɾෛ࠴ͷՕॴ ɾ࣍ظόʔδϣϯͰಈ͔ͳ͘ͳΔՕॴ
ෛ࠴ΛೝࣝͰ͖Δ RailsͷόʔδϣϯΛ্͛Δ࣌ʹ ࣮֬ʹฦࡁ͞ΕΔ
͓ΘΓ
pixivFACTORY 1+ͰऴΘΓ·ͨ͠
ීஈ͔Βෛ࠴ΛݮΒͯ͠ ։ൃʹूத͠·͠ΐ͏
ΤϯδχΞืूதʂ