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
どうして僕の作ったクラスが手続き型と言われなきゃいけないんですか
akikogoto
1
120
現場で役立つモデリング 超入門
masuda220
PRO
15
3.2k
Compose 1.7のTextFieldはPOBox Plusで日本語変換できない
tomoya0x00
0
190
Click-free releases & the making of a CLI app
oheyadam
2
110
Contemporary Test Cases
maaretp
0
130
ヤプリ新卒SREの オンボーディング
masaki12
0
130
Less waste, more joy, and a lot more green: How Quarkus makes Java better
hollycummins
0
100
Creating a Free Video Ad Network on the Edge
mizoguchicoji
0
120
광고 소재 심사 과정에 AI를 도입하여 광고 서비스 생산성 향상시키기
kakao
PRO
0
170
EventSourcingの理想と現実
wenas
6
2.3k
型付き API リクエストを実現するいくつかの手法とその選択 / Typed API Request
euxn23
8
2.2k
ペアーズにおけるAmazon Bedrockを⽤いた障害対応⽀援 ⽣成AIツールの導⼊事例 @ 20241115配信AWSウェビナー登壇
fukubaka0825
6
1.9k
Featured
See All Featured
[RailsConf 2023] Rails as a piece of cake
palkan
52
4.9k
Keith and Marios Guide to Fast Websites
keithpitt
409
22k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
191
16k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
26
1.4k
Music & Morning Musume
bryan
46
6.2k
Build The Right Thing And Hit Your Dates
maggiecrowley
33
2.4k
How to train your dragon (web standard)
notwaldorf
88
5.7k
The Language of Interfaces
destraynor
154
24k
Reflections from 52 weeks, 52 projects
jeffersonlam
346
20k
Java REST API Framework Comparison - PWX 2021
mraible
PRO
28
8.2k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
126
18k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
27
4.3k
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ͰʮτϨλʯͰݕࡧ