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
startupでもrails使うなら これだけはやっとけ的 tips集
Search
Kazuhiro Serizawa
September 27, 2016
Programming
19
10k
startupでもrails使うなら これだけはやっとけ的 tips集
第一回スタートアップRails勉強会でLTしたスライドです
Kazuhiro Serizawa
September 27, 2016
Tweet
Share
More Decks by Kazuhiro Serizawa
See All by Kazuhiro Serizawa
Accelerating Machine Learning I/O by Overlapping Data Staging and Mini-batch Generations
serihiro
1
280
hpc170_slide.pdf
serihiro
0
45
画像解像度別ImageNetの100 iterationの合計処理時間比較
serihiro
0
94
深層ニューラルネットワークにおける訓練高速化のための自動最適化
serihiro
0
41
Introduction to Parallel Computing 2.2
serihiro
0
51
My summer internship result at Treasure Data 2018 #td_intern
serihiro
0
2k
つらくないコードレビューの運用
serihiro
43
20k
5分で分かるかもしれないjava8 Stream API
serihiro
1
2.2k
Other Decks in Programming
See All in Programming
これが俺の”自分戦略” プロセスを楽しんでいこう! - Developers CAREER Boost 2024
niftycorp
PRO
0
190
Jakarta EE meets AI
ivargrimstad
0
260
見えないメモリを観測する: PHP 8.4 `pg_result_memory_size()` とSQL結果のメモリ管理
kentaroutakeda
0
400
SymfonyCon Vienna 2025: Twig, still relevant in 2025?
fabpot
3
1.2k
MCP with Cloudflare Workers
yusukebe
2
220
Amazon S3 NYJavaSIG 2024-12-12
sullis
0
100
From Translations to Multi Dimension Entities
alexanderschranz
2
130
ゆるやかにgolangci-lintのルールを強くする / Kyoto.go #56
utgwkk
2
390
PSR-15 はあなたのための ものではない? - phpcon2024
myamagishi
0
140
Exploring: Partial and Independent Composables
blackbracken
0
100
ドメインイベント増えすぎ問題
h0r15h0
2
350
Androidアプリのモジュール分割における:x:commonを考える
okuzawats
1
140
Featured
See All Featured
Fontdeck: Realign not Redesign
paulrobertlloyd
82
5.3k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
28
9.1k
Scaling GitHub
holman
458
140k
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
226
22k
Agile that works and the tools we love
rasmusluckow
328
21k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
26
1.5k
How to Ace a Technical Interview
jacobian
276
23k
Visualization
eitanlees
146
15k
Optimising Largest Contentful Paint
csswizardry
33
3k
Embracing the Ebb and Flow
colly
84
4.5k
The Pragmatic Product Professional
lauravandoore
32
6.3k
Fantastic passwords and where to find them - at NoRuKo
philnash
50
2.9k
Transcript
startupͰrails͏ͳΒ ͜Ε͚ͩͬͱ͚త tipsू Kazuhiro Serizawa @seri_k Toreta, Inc. қɿ͔ΜͨΜ Startup
Rails #1
About me • Kazuhiro Serizawa • github: :serihiro • work_at:
• work: :serverside engineer(rails) • like: %i(ruby java erlang c)
ࠓ͢͜ͱ • StartupͰਓ͕গͳͯ͘͜Ε͚ͩͬͱ͍ ͨํ͕͍͍ͱࢥ͏tipsΛ̎ͭ͠·͢ • ։ൃͱݴ͏͔ӡ༻ʹ͍ۙͰ͢
ͦͷ1 ModelͷValidation࠷ॳ͔ΒೖΕΔ • webΞϓϦ։ൃॳظ ʮ͜ͷϞσϧ༷ܾ·ͬͯͳ͍͔Β ɹ࠷ॳValidationແ͠ͰͱΓ͑͋ͣೖΕΑ͏ɻ ɹͪΖΜશΧϥϜNullڐՄͩΑͶˑʯ
class Reservation < ActiveRecord::Base end class CreateReservations < ActiveRecord::Migration def
change create_table :reservations do |t| t.integer :restaurant_id, null: true t.integer :number, null: true t.datetime :from, null: true t.datetime :to, null: true t.integer :status, null: true t.timestamps null: false end end end ͦͷ1 ModelͷValidation࠷ॳ͔ΒೖΕΔ
ͦͷ1 ModelͷValidation࠷ॳ͔ΒೖΕΔ • ͋Ε͔Β3͕ܦͬͨ… • ࠷ۙೖࣾͨ͠एऀᐌ͘ ʮͳΜͰ͜ͷϞσϧҰvalidation͍ͭͯͳ͍Μ͔͢ɻ TableʹNotNull੍ͳͯ͘Կ͢Δʹͯ͠nilνΣοΫ ඞਢ͡Όͳ͍͔͢ɻ ͢Ͱʹ9,000ສ݅Ϩίʔυ͋ͬͯࠓ͔Βmigration͢Δ
ͷΊͪΌͪ͘Όେม͡Όͳ͍͔͢ɻΞϗͰ͔͢ઌഐɻʯ
ͦͷ1 ModelͷValidation࠷ॳ͔ΒೖΕΔ • ҰෆదͳσʔλΛ࡞ΓࠐΜͰ͠·͏ͱޙ͔Β ͷमਖ਼͕ͬͬͭ͘͘͢͢͝͝Β͍ʂʂ • ͋ΔͷσϓϩΠޙɺ੍͕؇͔ͬͨ࣌ʹฆ Εͨมͳσʔλͷ͍ͤͰΤϥʔࡇΓʹͳͬͯ৭Μ ͳॴʹԼ࠲ͯ͠ճΔӋʹͳΔʢ࣮ʣ •
͔ͦ͠͏͍͏มͳσʔλ͕ೖ͍ͬͯΔͱ͍͏ࣄ ࣮࠷ॳ͔Β͍ͨਓؒʹ͔͔͠Βͳ͍ɻɻ
ͦͷ1 ModelͷValidation࠷ॳ͔ΒೖΕΔ • ͳͷͰ • Validationͷ༷͕ܾ·Βͳ͍΄Ͳཁ͕ܾ݅·Β ͳ͍͏ͪʹproductionʹೖ͠ͳ͍ • TableʹNot NullɺUnique੍Modelͷ
validationͱซͤͯͪΌΜͱઃఆ͢Δ ˞uniqueness: true͍ͱ؆୯ʹ͢Γൈ͚Δ
• productionͰΤϥʔग़ͯΔͷ์ஔ͢Δͱةͳ͍Α Ͷʔɺͱ͍͏ׂͱͨΓલͷ • ͔͠͠Τϥʔͷهɾཧ݁ߏΊΜͲ͍͘͞ • fluentdೖΕͯElasticSearchʹूΊͯkibanaͰݟ ΔʁESࣗୡͰӡ༻͢ΔʁͲ͏ͬͯΤϥʔ͕ ى͖ͨ͜ͱΛΔʁͲ͏ͬͯΤϥʔΛཧ͢Δʁ ͦͷ2
͓खܰʹΤϥʔΛݟ͑ΔԽ͢Δ
ͦͷ2 ͓खܰʹΤϥʔΛݟ͑ΔԽ͢Δ https://bugsnag.com
• railsͰൃੜͨ͠ྫ֎Λશ෦هͯ͘͠ΕΔ ͦͷ2 ͓खܰʹΤϥʔΛݟ͑ΔԽ͢Δ
• github,slackͱͷintegration͕Մೳ ͦͷ2 ͓खܰʹΤϥʔΛݟ͑ΔԽ͢Δ
• ηοτΞοϓgemೖΕͯgeneratorͰ initializerΛੜ͢Δ͚ͩ ͦͷ2 ͓खܰʹΤϥʔΛݟ͑ΔԽ͢Δ
·ͱΊ • validationޙ͔Β͖ͨएऀʹdisΒΕΔલʹ ೖΕ·͠ΐ͏ • bug؆୯ʹՄࢹԽͰ͖ΔͷͰ࠷ॳ͔ΒೖΕ ·͠ΐ͏
͝ਗ਼ௌ͋Γ͕ͱ͏͍͟͝·ͨ͠ • גࣜձࣾτϨλαʔόʔαΠυ(rails) ΤϯδχΞืूதͰ͢ʂ WantedlyͰʮτϨλʯͰݕࡧ