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
290
hpc170_slide.pdf
serihiro
0
48
画像解像度別ImageNetの100 iterationの合計処理時間比較
serihiro
0
98
深層ニューラルネットワークにおける訓練高速化のための自動最適化
serihiro
0
44
Introduction to Parallel Computing 2.2
serihiro
0
53
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
AppRouterを用いた大規模サービス開発におけるディレクトリ構成の変遷と問題点
eiganken
1
450
「とりあえず動く」コードはよい、「読みやすい」コードはもっとよい / Code that 'just works' is good, but code that is 'readable' is even better.
mkmk884
6
1.4k
PHPで作るWebSocketサーバー ~リアクティブなアプリケーションを知るために~ / WebSocket Server in PHP - To know reactive applications
seike460
PRO
2
770
20241217 競争力強化とビジネス価値創出への挑戦:モノタロウのシステムモダナイズ、開発組織の進化と今後の展望
monotaro
PRO
0
290
Rubyでつくるパケットキャプチャツール
ydah
0
170
PicoRubyと暮らす、シェアハウスハック
ryosk7
0
220
Androidアプリのモジュール分割における:x:commonを考える
okuzawats
1
280
traP の部内 ISUCON とそれを支えるポータル / PISCON Portal
ikura_hamu
0
180
watsonx.ai Dojo #6 継続的なAIアプリ開発と展開
oniak3ibm
PRO
0
170
HTML/CSS超絶浅い説明
yuki0329
0
190
php-conference-japan-2024
tasuku43
0
430
DevFest - Serverless 101 with Google Cloud Functions
tunmise
0
140
Featured
See All Featured
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
507
140k
Java REST API Framework Comparison - PWX 2021
mraible
28
8.3k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
7
570
The Power of CSS Pseudo Elements
geoffreycrofte
74
5.4k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
132
33k
Large-scale JavaScript Application Architecture
addyosmani
510
110k
Music & Morning Musume
bryan
46
6.3k
What's in a price? How to price your products and services
michaelherold
244
12k
Stop Working from a Prison Cell
hatefulcrawdad
267
20k
What’s in a name? Adding method to the madness
productmarketing
PRO
22
3.2k
Designing on Purpose - Digital PM Summit 2013
jponch
116
7.1k
Done Done
chrislema
182
16k
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ͰʮτϨλʯͰݕࡧ