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
410
Railsのための負債の減らし方
alpaca-tc
September 27, 2016
Tweet
Share
More Decks by alpaca-tc
See All by alpaca-tc
~Rubyと暮らし、OSSに貢献し、登壇する~ 半年間続けた「OSSやっていきの集い」の成果と学び
alpacatc
0
15
TracePointを活用してモデル名変更の負債解消をした話
alpacatc
2
1.5k
Railsのモデル名をすべて変更した話
alpacatc
0
410
新規サービス立ち上げを経て気づいたマネーフォワードの文化
alpacatc
0
1.6k
Attributes API 実践
alpacatc
4
1.9k
Mastodonを3倍早くしたい話
alpacatc
0
2.9k
AdminScriptで管理画面をスッキリさせる
alpacatc
3
650
[pixiv summer boot camp] pixivFACTORY
alpacatc
0
3.5k
Featured
See All Featured
Building Flexible Design Systems
yeseniaperezcruz
328
38k
VelocityConf: Rendering Performance Case Studies
addyosmani
328
24k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
51
2.4k
The Art of Programming - Codeland 2020
erikaheidi
53
13k
Product Roadmaps are Hard
iamctodd
PRO
52
11k
Designing for humans not robots
tammielis
250
25k
Reflections from 52 weeks, 52 projects
jeffersonlam
349
20k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
231
53k
Scaling GitHub
holman
459
140k
Building Adaptive Systems
keathley
41
2.5k
Adopting Sorbet at Scale
ufuk
75
9.3k
Testing 201, or: Great Expectations
jmmastey
42
7.4k
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+ͰऴΘΓ·ͨ͠
ීஈ͔Βෛ࠴ΛݮΒͯ͠ ։ൃʹूத͠·͠ΐ͏
ΤϯδχΞืूதʂ