This document provides an introduction to the Ruby on Rails framework through a series of exercises. It introduces Rails development environments and commands. It explains the Model-View-Controller pattern and shows how to create Rails applications, add views and routes, display "Hello World", and deploy apps to Heroku. Later exercises guide users through additional Rails features and direct them to online resources for continued learning.
1 of 16
Download to read offline
More Related Content
Rails intro
1. R U B Y O N R A I L S I N T R O D U C T I O N
W I L L A R D S T E R L I N G
3. L E T S G E T S T AR T E D
E X E R C I S E 1 - D E V E L O P M E N T
E N V I R O N M E N T
Follow Exercise 1 README -
https://github.com/will-
sterling/RAILS-
Intro/blob/exercise1/README.
md
5. E X E R C I S E 2 -
C R E A T E A R A I L S
A P P
Follow Exercise 2 README -
https://github.com/will-
sterling/RAILS-
Intro/blob/exercise2/README.
md
6. M V C : M O D E L - V I E W - C O N T R O L L E R
M O D E L V I E W
C O N T R O L
L E R
14. E X E R C I S E 5 -
F O L L O W T H E G U I D E
http://guides.rubyonrails.org/
Getting Started - Chapter 5
When done push to Heroku
15. F I N I S H T H E G U I D E , L E A R N &
C R E A T E
G O F O R T H
16. R E S O U R C E S
sterling.codes
http://guides.rubyonrails.org
http://rubyonrails.org/community
https://devcenter.heroku.com/articles/getting-started-with-ruby
@will-sterling
Editor's Notes
#2: Introduce Yourself
We will be learning about Ruby on Rails
How to use a web IDE to build our project
We will use GIT for revision control, sharing and publishing
Heroku to host our app
#3: Ruby on Rails
Is a web application framework
Written in Ruby of course
It does all of the common tasks or infrastructure that our common among web applications so you can focus on the unique aspects of the application you are building.
The RAILS Way- CoC, DRY, MVC
Convention over configuration or strongly opinionated Rails will look for your code in specific places in the project structure with out any configuration. So if you stick to convention you just need to stick code snippets in the correct place to make large changes. - hint at models and views but avoid deep discussion
#7: Just cover the basics of what each of these are. We will visit each later on and in the exercises.
#8: HTML/JS page templates presented to user
Should only contain minimal code. e.x. looping through array to display list of data
Should not contain business logic
Template languages ERB:default, HAML
#9: rake routes
config/routes.rb
OperationonresourceMethod&URIControlleraction
Index(list)moviesGET/moviesindex
Read(show)existingmovieGET/movies/:idshow
Displayfill-informfornewmovieGET/movies/newnew
Createnewmoviefromfilled-informPOST/moviescreate
DisplayformtoeditexistingmovieGET/movies/:id/editedit
Updatemoviefromfill-informPUT/movies/:idupdate
DestroyexistingmovieDELETE/movies/:iddestroy
Discuss that the routes are RESTful
Discuss the need for new and create. New is only needed for interactive user facing web app. API user sends all required data to create without calling new.
#12: We saw view earlier. Now we are going to talk about models and controllers.
#13: https://en.wikipedia.org/wiki/Active_record_pattern - In software engineering, the active record pattern is an architectural pattern found in software that stores in-memory object data in relational databases. It was named by Martin Fowler in his 2003 book Patterns of Enterprise Application Architecture.[1] The interface of an object conforming to this pattern would include functions such as Insert, Update, and Delete, plus properties that correspond more or less directly to the columns in the underlying database table.
Serialize/Deserialize Data
Provides methods of describing data relationships and access to data
Provides methods for updating RDBMS Schema
Manipulate, change, delete data
#14: Prepare data for Presentation
Contain Business Logic
Methods Matching CRUD operations
#16: Finish the RAILS Guide, getting started is just the beginning of the guide, there is in depth material on each topic we discussed today plus more. Make sure to read the Debugging chapter early, dont wait till the end!
Create your own side project! Put it on GitHub! Put it on Heroku!
Hang out in IRC