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
rails-master-road-1.pdf
Search
chionyan
February 15, 2019
Programming
0
82
rails-master-road-1.pdf
chionyan
February 15, 2019
Tweet
Share
More Decks by chionyan
See All by chionyan
レンタルカメラ広告提案資料
chionyan
0
710
Other Decks in Programming
See All in Programming
「待たせ上手」なスケルトンスクリーン、 そのUXの裏側
teamlab
PRO
0
570
Navigation 2 を 3 に移行する(予定)ためにやったこと
yokomii
0
350
アルテニア コンサル/ITエンジニア向け 採用ピッチ資料
altenir
0
110
Putting The Genie in the Bottle - A Crash Course on running LLMs on Android
iurysza
0
140
「手軽で便利」に潜む罠。 Popover API を WCAG 2.2の視点で安全に使うには
taitotnk
0
870
概念モデル→論理モデルで気をつけていること
sunnyone
3
300
Platformに“ちょうどいい”責務ってどこ? 関心の熱さにあわせて考える、責務分担のプラクティス
estie
1
140
AIを活用し、今後に備えるための技術知識 / Basic Knowledge to Utilize AI
kishida
22
5.9k
パッケージ設計の黒魔術/Kyoto.go#63
lufia
3
440
Updates on MLS on Ruby (and maybe more)
sylph01
1
180
AIでLINEスタンプを作ってみた
eycjur
1
230
Navigating Dependency Injection with Metro
zacsweers
3
3.5k
Featured
See All Featured
Fantastic passwords and where to find them - at NoRuKo
philnash
52
3.4k
A Tale of Four Properties
chriscoyier
160
23k
Measuring & Analyzing Core Web Vitals
bluesmoon
9
580
Mobile First: as difficult as doing things right
swwweet
224
9.9k
Designing for Performance
lara
610
69k
Rails Girls Zürich Keynote
gr2m
95
14k
The Power of CSS Pseudo Elements
geoffreycrofte
77
6k
Building an army of robots
kneath
306
46k
StorybookのUI Testing Handbookを読んだ
zakiyama
31
6.1k
KATA
mclloyd
32
14k
Statistics for Hackers
jakevdp
799
220k
YesSQL, Process and Tooling at Scale
rocio
173
14k
Transcript
Ruby on Rails Master への道 〜導入編〜 @chionyan 公開日時:2019/2/15
Rails でアプリを作るのは超簡単!
超簡単 Rails 下準備をする // プロジェクトを作る $ rails new sample-app //
ライブラリを入れる $ bundle install
超簡単 Rails // User に関する色々を作ってくれる $ rails generate scaffold User
name:string em // DB を作る $ rails db:migrate データを操作する色々を作る
超簡単 Rails $ rails server サーバーを起動する
超簡単 Rails できました!
超簡単 Rails User を作成することもできる!
超簡単 Rails User を作成することもできる!
超簡単 Rails 一覧にも出てくる!
すごーい!!!
Rails チュートリアル Rails チュートリアルでは、 scaffold がよしなにやってくれた内容を、 ・Routing ・Model ・Controller ・View
・バリデーション、関連、セッション... など一つ一つ基礎の部分を写経して、 アプリケーションを作っていく。
でも、、
実際何やってるの??
Ruby を知る ポテンシャルエンジニア研修で も使った名著。 Rails のフレームワークで使われ ている Ruby について丁寧に解 説してある。
まずはこれで Ruby を知ろう。 「プロを目指す人のための Ruby 入門」
Rails を知ろう 「Ruby on Rails ガイド」
Ruby on Rails ガイド ガイド目次です。 さっき4つくらいのコマンドで 終わったことや、モデル、ビュ ー、コントローラーで行われて いることもここで細かく説明さ れています。
多い・・・。
ちょっとだけ見せ
Active Record マイグレーション # 下記のコードが作成される(DB 作る用) class AddLocationToUsers < ActiveRecord::Migration
def change add_column :users, :location, :string end end // users テーブルに location カラムを追加する $ rails g migration AddLocationToUsers locati // DB を更新する $ rails g db:migrate
Active Record マイグレーション class AddLocationToUsers < ActiveRecord::Migration def up add_column
:users, :location, :string end def down remove_column :users, :location, :string end end こう手直しした方が融通が効きやすい!! (可逆性がある)
そういうことがわかります。。
もっと知りたい人は、
こことか、こことか
rails / rails User を作成することもできる!
読めたらいいな。。。
おしまい