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
400
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
620
[pixiv summer boot camp] pixivFACTORY
alpacatc
0
3.5k
Featured
See All Featured
The Illustrated Children's Guide to Kubernetes
chrisshort
48
49k
Mobile First: as difficult as doing things right
swwweet
222
9k
Bash Introduction
62gerente
610
210k
Stop Working from a Prison Cell
hatefulcrawdad
267
20k
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
226
22k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
27
1.5k
Building Flexible Design Systems
yeseniaperezcruz
328
38k
Building an army of robots
kneath
302
45k
StorybookのUI Testing Handbookを読んだ
zakiyama
28
5.4k
Building Your Own Lightsaber
phodgson
104
6.2k
Fireside Chat
paigeccino
34
3.1k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
160
15k
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+ͰऴΘΓ·ͨ͠
ීஈ͔Βෛ࠴ΛݮΒͯ͠ ։ൃʹूத͠·͠ΐ͏
ΤϯδχΞืूதʂ