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
41
画像解像度別ImageNetの100 iterationの合計処理時間比較
serihiro
0
89
深層ニューラルネットワークにおける訓練高速化のための自動最適化
serihiro
0
36
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
.NET のための通信フレームワーク MagicOnion 入門 / Introduction to MagicOnion
mayuki
1
1.7k
アジャイルを支えるテストアーキテクチャ設計/Test Architecting for Agile
goyoki
9
3.3k
카카오페이는 어떻게 수천만 결제를 처리할까? 우아한 결제 분산락 노하우
kakao
PRO
0
110
Quine, Polyglot, 良いコード
qnighy
4
650
2024/11/8 関西Kaggler会 2024 #3 / Kaggle Kernel で Gemma 2 × vLLM を動かす。
kohecchi
5
940
TypeScriptでライブラリとの依存を限定的にする方法
tutinoko
3
690
イベント駆動で成長して委員会
happymana
1
340
3 Effective Rules for Using Signals in Angular
manfredsteyer
PRO
0
120
ローコードSaaSのUXを向上させるためのTypeScript
taro28
1
630
NSOutlineView何もわからん:( 前編 / I Don't Understand About NSOutlineView :( Pt. 1
usagimaru
0
340
Arm移行タイムアタック
qnighy
0
330
タクシーアプリ『GO』のリアルタイムデータ分析基盤における機械学習サービスの活用
mot_techtalk
4
1.5k
Featured
See All Featured
Fashionably flexible responsive web design (full day workshop)
malarkey
405
65k
Typedesign – Prime Four
hannesfritz
40
2.4k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
6
430
Happy Clients
brianwarren
98
6.7k
Large-scale JavaScript Application Architecture
addyosmani
510
110k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
356
29k
Code Reviewing Like a Champion
maltzj
520
39k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
42
9.2k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
665
120k
How STYLIGHT went responsive
nonsquared
95
5.2k
Faster Mobile Websites
deanohume
305
30k
Practical Orchestrator
shlominoach
186
10k
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ͰʮτϨλʯͰݕࡧ