Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Rails初心者がSPAアプリを作ってみた話
Search
Kouichi(19)
July 20, 2019
Technology
250
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Rails初心者がSPAアプリを作ってみた話
Kouichi(19)
July 20, 2019
More Decks by Kouichi(19)
See All by Kouichi(19)
農業AIアイディアソンに参加してきた
koty
0
640
Google Home アプリを作った話
koty
0
72
Other Decks in Technology
See All in Technology
AWS DevOps Agent スキルをつかいこなそう / Master AWS DevOps Agent Skills
kinunori
2
660
覗いてみよう 関数型ビジュアル言語×2Dグラフィックスの世界
yohyamasaki
0
160
OSC2026on_the-world-is-waiting-for-your-voice.pdf
naruoga
0
240
Lambda MicroVMsは常駐サーバーの代わりに なるか? Kiro Crew を動かして検証してみた / Kiro Crew on Lambda MicroVMs
k_adachi_01
2
350
AI駆動開発、viviONの1年 ── うまくいったこと・いかなかったこと
vivion
0
140
AIに攻撃される前に、AIに攻撃させる
tsuchikazu
0
110
Oracle Base Database Service 技術詳細
oracle4engineer
PRO
16
120k
Swap and Memory Reclaim - Squeezing Out More RAM
ennael
PRO
1
1.5k
FinTech 1-2 : Overview of FinTech
ks91
PRO
0
130
IR Today: Theory, Practice, and Agents
dtunkelang
0
330
HacobuにおけるFDEとは/登壇資料(戸井田 裕貴)
hacobu
PRO
1
710
AI Native Platform Engineering 〜PlatformとAgileで“作る速さ”を“価値”へ〜
uya116
0
600
Featured
See All Featured
エンジニアに許された特別な時間の終わり
watany
109
250k
Stewardship and Sustainability of Urban and Community Forests
pwiseman
0
540
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
194
17k
Claude Code のすすめ
schroneko
67
230k
The Impact of AI in SEO - AI Overviews June 2024 Edition
aleyda
6
1.2k
How Software Deployment tools have changed in the past 20 years
geshan
2
34k
Everyday Curiosity
cassininazir
0
340
A brief & incomplete history of UX Design for the World Wide Web: 1989–2019
jct
2
520
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
38
3k
End of SEO as We Know It (SMX Advanced Version)
ipullrank
3
4.4k
Lightning Talk: Beautiful Slides for Beginners
inesmontani
PRO
2
710
Lessons Learnt from Crawling 1000+ Websites
charlesmeaden
PRO
1
1.6k
Transcript
Rails初心者がSPAアプリを作っ てみた話 長野Rubyの会 #2 2019.7.20 於 GEEKLAB.NAGANO
自己紹介 • にしざわこういち • プログラマー • @koty • 元ギークラ某長野 管理人見習い
• 最近転職しました
プログラミング言語歴 VisualBasic.NET ・・・10年 C# ・・・10年 Java ・・・3年 Python ・・・4年 TypeScript
・・・1年 Ruby ・・・1ヶ月
None
前回発表内容
前回発表内容
今日の発表内容 勉強がてら作ってみているアプリの話 https://glide-well.b-sw.co/#/workouts/ 発表することで教えてもらうスタイル
アプリでできること • 水泳の練習メニューの記録 • 練習内容のslackへの投稿 ◦ 現状は、整形したメッセージをクリップボードに入れるだけ • 俺得アプリ
SPAで作った • このご時世、サーバーサイドのWebフレームワークのみでシステムを作れること はまずない • 特にFormはSPAで作るほうが楽。配列の扱いとか • 認証を通せるようにしたら自分で使う予定
システム構成 CloudFrontでルーティング ブラウザ CloudFront heroku S3 index.html /api/* Rails vue.js
https://github.com/koty/glide-well-front https://github.com/koty/glide-well-api Railsだと何も考えずに herokuにpushするだけで動く。すご い。。。
webpacker • webpackをrailsで包んだものらしい • 最初使いかけたが挫折 • frontとapiを分けることにした
front - api でアプリを分ける長所 • webpackerを覚える必要がない • vue.jsのノウハウをそのまま使える • アプリケーションサーバーが静的ファイルを扱わなくて良い
◦ アプリケーションサーバーの負荷がちょっと減る
front - api でアプリを分ける短所 • ソース管理が煩雑 • コミットがまとまらない • ローカルでのデバッグが面倒
ActiveModelSerializers モデルのオブジェクトをJSONにしてくれるgem ネストしたJSONをpostして更新するきれいな方法がよく分からなかった w = params.permit(:id, :date, :kind, :impression) if
@workout.update(w) update_details(@workout.id) def update_details(workout_id) WorkoutDetail.where(workout_id: workout_id).delete_all p = params.permit(:id, :date, :kind, :impression, workout_details: [:id, :menu_kind, :times, :distance, details = p[:workout_details] details.each do |detail| rec = WorkoutDetail.new(detail) rec.workout_id = workout_id rec.save end
おしまい Railsを教えられるようにがんばります