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
260
hpc170_slide.pdf
serihiro
0
41
画像解像度別ImageNetの100 iterationの合計処理時間比較
serihiro
0
89
深層ニューラルネットワークにおける訓練高速化のための自動最適化
serihiro
0
33
Introduction to Parallel Computing 2.2
serihiro
0
48
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
LangChainでWebサイトの内容取得やGitHubソースコード取得
shukob
0
160
GraphQLの魅力を引き出すAndroidクライアント実装
morux2
3
680
Desafios e Lições Aprendidas na Migração de Monólitos para Microsserviços em Java
jessilyneh
2
150
Using Livebook to build and deploy internal tools @ ElixirConf 2024
hugobarauna
0
250
ECMAScript、Web標準の型はどう管理されているか / How ECMAScript and Web standards types are maintained
petamoriken
3
390
Some more adventure of Happy Eyeballs
coe401_
2
190
2024 컴포즈 정원사
jisungbin
0
150
Method Swizzlingを行うライブラリにおけるマルチモジュール設計
yoshikma
0
120
私のEbitengineの第一歩
qt_luigi
0
450
エラーレスポンス設計から考える、0→1開発におけるGraphQLへの向き合い方
bicstone
5
1.5k
What you can do with Ruby on WebAssembly
kateinoigakukun
0
170
Perl 5 OOP機構30年史 - Perl 5's OOP Mechanism over the past 30 years
moznion
0
340
Featured
See All Featured
Debugging Ruby Performance
tmm1
72
12k
The Mythical Team-Month
searls
218
43k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
157
15k
How to Ace a Technical Interview
jacobian
274
23k
Building a Modern Day E-commerce SEO Strategy
aleyda
36
6.8k
For a Future-Friendly Web
brad_frost
174
9.3k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
131
32k
The Language of Interfaces
destraynor
153
23k
Infographics Made Easy
chrislema
239
18k
Build The Right Thing And Hit Your Dates
maggiecrowley
30
2.3k
Six Lessons from altMBA
skipperchong
26
3.4k
5 minutes of I Can Smell Your CMS
philhawksworth
202
19k
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ͰʮτϨλʯͰݕࡧ