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歴2年(🐥)の私が Cakeを半年触って学んだこと
Search
manamin0521
September 18, 2018
Programming
1.1k
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Rails歴2年(🐥)の私が Cakeを半年触って学んだこと
コネヒトさんとのランチLTにて使用しました
manamin0521
September 18, 2018
More Decks by manamin0521
See All by manamin0521
ランサーズを支える管理画面
manamin0521
2
4.7k
Other Decks in Programming
See All in Programming
App Storeの外へ──日本のiOSサイドローディング入門 for iOSDC Japan 2026
yuukiw00w
0
140
【DroidKaigi 2026】「アクセシビリティを利用するとき、 アクセシビリティもまたこちらを利用している」 〜マルウェアによる攻撃と防衛について〜
halunoyo
0
430
typoなんかねぇよ
raspython3
0
680
Swift愛好会と私(ウホーイ) / Swift Fan Club and Uhooi
uhooi
0
150
Hono + Inertia + React で LP を構築した話
oukayuka
2
220
AI × TiDD / 2026.09.05 Redmine 大阪
tokudiro
1
120
スマート反転とウェブアクセシビリティ
camiha
0
180
What We Talk About When We Talk About XP
m_seki
2
450
業務時間外もAIに働いてもらう話
colorful12
3
10k
Swift愛好会100回記念 第1回を振り返る
jollyjoester
0
120
不幸な GC
chencmd
0
900
モバイル交通系ICへのチャージ実例から考える、クロスプラットフォーム開発におけるiOS実機テスト設計とCI運用
yusuga
1
260
Featured
See All Featured
B2B Lead Gen: Tactics, Traps & Triumph
marketingsoph
0
240
Lightning Talk: Beautiful Slides for Beginners
inesmontani
PRO
2
680
エンジニアに許された特別な時間の終わり
watany
108
250k
Utilizing Notion as your number one productivity tool
mfonobong
4
580
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
31
2.9k
Applied NLP in the Age of Generative AI
inesmontani
PRO
4
2.4k
Kristin Tynski - Automating Marketing Tasks With AI
techseoconnect
PRO
0
510
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
254
22k
The SEO identity crisis: Don't let AI make you average
varn
0
550
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
287
14k
Un-Boring Meetings
codingconduct
0
410
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
PRO
202
76k
Transcript
Rails歴2年()の私が Cakeを半年触って 学んだこと
自己紹介 松原愛美 ランサーズ株式会社1年目 CRE @manamin0521m 学生時代インターンにてRails 2
今日話すこと 2つの言語(フレームワーク)で開発したことで、 それぞれの違いを知る → 違いから気づいたことについて 3
CakePHP 1.3→2.8 PHP 5.3 Version 4
言語仕様の違い
1. viewに値を渡す時の違い Rails @user = User.find(1) Cake2.8 $user = $this->User->findById(1); $this->set(user,
$user); 6
「インスタンス変数」の認識の誤りに気づく ◂ Ruby時代は「viewに値を渡せる変数」と認識 ◂ 本来はメソッド内のみ使用可という意味 → オブジェクト指向の理解のきっかけに 7
2. 返り値の理解 Ruby def plus(num1, num2){ sum = num1 +
num2 } sum = plus(10, 8) puts '加算の結果は#{ sum }です' 最後に評価された値が返る ※指定することも可能 PHP5.3 function plus($num1, $num2){ $sum = $num1 + $num2; return $sum; } $sum = plus(10, 8); print '加算の結果は'.$sum.'です'; Returnが必要 8
3. 変数と関数の違い Ruby 変数 @user = @user.id 関数(メソッド) Post.test PHP5.3
変数 $userId = $this->User->id; 関数(メソッド) $this->Post->test(); 9
3. 変数と関数の違いを意識 ◂ PHPは関数(メソッド)を使う場合、 引数が空なら()が必要 ◂ Ruby時代はピリオドで繋ぎ、直感的に取り出していた 10
配列とオブジェクト
1. 配列の扱い方 Ruby a = [1, 2, 3] a.include?(x) a.empty?
(※Arrayクラス) PHP $a = array(1, 2, 3);(※5.3) $a = [1, 2, 3];(※5.4以降) in_array( $x, $a ); empty( $a ); 12
2. Findした結果が配列かオブジェクトか Cake2.8 Findした結果が配列 $User['id'] (3以降はオブジェクト) ※オブジェクトから値を 取り出すとき $user->id Rails
Findした結果が オブジェクト @User.id 13
3. FormからデータをPostした時の処理 Rails Paramsで受け取る createメソッドが オブジェクト化して オブジェクトをsave Cake2.8 $this->request->data; saveメソッドが
配列を引数に取るため 配列をsave 14
4. 複数テーブルを結合して値を取り出す時 Rails user = User.find(params: id) @user = user.user_profiles
オブジェクト Cake2.8 $user = $this->User->find('first', array( 'conditions' => array('User.id' => $id), 'contain' => array('UserProfile') )); $user[‘UserProfile’]; 配列 15
感じたこと Ruby時代はコピペと感覚で なんとかなってたけど PHPは省略できない部分がRubyより多い 違いの理由を学ぶことで勉強になる 複数の言語、フレームワークに触れた方がいいと言わ れる理由がわかった 16
ありがとう ございました! 17