10. Ruby vs. Rails
Ruby is the Language -
developed 1993
Yukihiro Matsumoto “Matz”
Rails is the Framework -
developed 2004
David Heinemeier Hansson “DHH”
10
11. The Ruby Way
Written in C
Influenced by SmallTalk & Pearl
Ruby is for People
MINSWAN
OSS (Open Source Software)
RubyGems
11
12. The Rails Way
Opinionated Software
Convention over Configuration
DRY (Don’t Repeat Yourself)
TDD (Test Driven Development)
Less Code, More Productivity
12
28. Sublime Text 2
Command line alias
Win: doskey subl="C:Program FilesSublime Text 2sublime_text.exe" $*
Mac: ln -s "/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl" ~/bin/subl
Linux: sudo ln -s /opt/SublimeText2/sublime_text /usr/bin/subl
How to Open a folder
28
Command line alias
Win: doskey subl="C:Program FilesSublime Text 2sublime_text.exe" $*
Mac: ln -s "/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl" ~/bin/subl
Linux: sudo ln -s /opt/SublimeText2/sublime_text /usr/bin/subl
How to Open a folder
31. Create a New App
rails
Shows Options
rails new <app_name> --options
31
32. Create a
Class Management App
We want an app to manage Students,
Classes, and Teachers
rails new class_mngmt
32
rails new class_mngmt
33. The Application
Directory
The Root of our App: Rails root
Entire App in one directory!
33
34. Run the App
cd class_mngmt
rails
see rails commands
rails server
34
rails server
35. Save a Baseline
with git
git init
git add .
git commit -m “add a bare rails app
to track changes”
35
git init
git add .
git commit -m “add bare rails app to track”
37. Scaffolding
rails generate
see the generators
rails g scaffold Student full_name
age:integer bio:text title
37
rails g scaffold Student full_name age:integer bio:text title
38. MVC
Response
Controller
Request
Browser
View
Model
Database
38
41. View Exercise
On the main Student page
Change the Listing Students to My
Students or All Students
Show only the Full Name and title
Have the Full Name link to the
view page
41
Command line aliasWin: doskey subl="C:\\Program Files\\Sublime Text 2\\sublime_text.exe" $*Mac: ln -s "/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl" ~/bin/sublLinux: sudo ln -s /opt/SublimeText2/sublime_text /usr/bin/sublHow to Open a folder
rails new class_mngmt
rails server
git init git add . git commit -m “add bare rails app to track”
rails g scaffold Student full_name age:integer bio:text title