SlideShare a Scribd company logo
Introduction to Ruby on Rails 
(aka: Rails for you) 
Go Frendi Gunawan
About Me 
● Go Frendi Gunawan 
● Developer of No-CMS and Kokoropy 
● Lecturer at STIKI Malang 
● Starting a startup business 
● http://gofrendiasgard.github.io
Ruby 
● A fully OOP programming language 
● Created by Yukihiro Matsumoto (Matz) 
● Influenced by Python, Perl, dan Java 
● Easy to write 
● A bit hard to read 
● Easy and fun to learn (http://tryruby.org) 
● Has interactive console called “irb” 
● Has package control library called “gem”
Ruby – Variable 
● Don't need to implicitly write datatype 
a = 5 
b = “Some string”
Ruby – Block 
● You can use “end” keyword, no curly braces as in C or Java: 
# branch 
if 3>4 
puts “She hates me” 
else 
puts “She loves me” 
end 
# loop 
i = 5 
while i>0 
puts i 
i = i-1 
end
Ruby – Function & Function Call 
● Define a function: 
def add(a,b) 
a+b 
end 
● This will works: 
add 4,5 
as well as this: 
add(4,5)
Ruby – Everything is object 
● No primitive datatype like java 
● This will yield “Hello world!”: 
“!dlrow elloH”.reverse 
A string like “!dlrow elloH” has reverse method, you don't even need to 
put it in a variable 
● This will yield 8: 
7.next 
● This will blow up your mind: 
[1,2,3,4,5].each{|num| puts num+1} 
It is like foreach in php. You iterate through the array, put each element 
into a local variable called “num” and print num+1 into the screen.
Ruby-Class & Object 
● Define a class 
class Scientist 
def initialize(name) 
@name = name 
end 
def introduce() 
puts “My name is ” +@name 
end 
end 
● Define an subclass 
class Mad_Scientist < Scientist 
end 
● Make object 
sheldon = Scientist.new(“Sheldon Cooper”) 
sheldon.introduce
Rails 
● A very good web framework 
● Full of “auto-magic” functionality 
● Created by David Heinemeier Hansson 
● Has several philosophy: 
– DRY (Don't Repeat Yourself) 
– MVC (Model View Controller) 
– Convention ofer Configuration (CoC) 
● Powering several big websites: 
– Github 
– Twitter 
– Shopify
Installing Rails 
● If you are using linux or Mac, you can follow 
installation steps in 
http://rubyonrails.org/download/ 
FYI: you can even use apt-get in ubuntu. 
● Windows user simply use this: 
http://railsftw.bryanbibat.net/ to save all the pain 
of compiling things.
Starting Rails 
● Open rails console, type this: 
rails new YOUR_APP_NAME 
● Rails will generate several files & folders for you. Basically, 
you only need to take attention on: 
– config 
– app/models 
– app/controllers 
– app/models 
● Type rails s and fire your browser to 
http://localhost:3000
Scaffolding – Rails's best feature 
● Scaffold articles 
– Rails g scaffold articles title:string 
body:text 
● Do “migration” (aka: create your database without 
touching it) 
– rake db:migrate 
● Fire your browser to http://localhost:3000/articles 
and it is.
Use bootstrap themes (1) 
● Add some gems first. Open 
YOUR_APP_NAME/Gemfiles, add this: 
– gem 'therubyracer' 
– gem 'less-rails' 
– gem 'twitter-bootstrap-rails' 
● Install the gems 
– bundle install
Use bootstrap themes (2) 
● install bootstrap 
– rails g bootstrap:install 
● Override Layout 
– rails g bootstrap:layout application 
fixed -f 
● Override article's theme 
– rails g bootstrap:themed articles -f 
● See the result
Here is what we made so far 
(Pretty cool for something we didn't even code...)
Tips and Tricks 
● If you want to change the view manually, just go 
to app/views folder 
● If you want articles to be your homepage, then 
you can modify config/routes.rb and add 
this: 
– root :to => "articles#index"
Further reading 
● http://tryruby.org/ 
● http://railsforzombies.org/ 
● http://guides.rubyonrails.org/getting_started.html
Conclusion 
● You have see how Ruby-on-Rails can help you 
develop application (or at least prototype) 
easily. 
● Rails is a great framework, it is very simple to 
make a working CRUD application. However, 
deeper understanding about the language and 
the framework is required if you want to build a 
serious application
Thank you 
ありがとう

More Related Content

What's hot (20)

PPTX
PHP and node.js Together
Chris Tankersley
 
PPTX
Javascript Frameworks Comparison
Deepu S Nath
 
PPTX
Proxying DBI with DBD::Gofer and App::Staticperl
nohuhu
 
PPT
Web development basics (Part-3)
Rajat Pratap Singh
 
PDF
Developing cross platform desktop application with Ruby
Anis Ahmad
 
PPTX
[Mas 500] Intro to Programming
rahulbot
 
PPTX
Evolution of java script libraries
Columbia Developers Guild
 
PPTX
Ruby, the language of devops
Rob Kinyon
 
PDF
FGCU Camp Talk
Mark Brooks
 
PPT
RubyMotion #jbday
Dennis Ushakov
 
PDF
Ruby projects of interest for DevOps
Ricardo Sanchez
 
PDF
Delayed operations with queues for website performance
OSInet
 
PPSX
Webpack & EcmaScript 6 (Webelement #32)
srigi
 
PPTX
Node.js 201: building real-world applications in pure JavaScript
Tom Boutell
 
PPT
Ruby application based on http
Richard Huang
 
PPT
Web development basics (Part-2)
Rajat Pratap Singh
 
PDF
GDI WordPress 1 January 2012
pamselle
 
PPTX
Introduction to JS frameworks
Deepu S Nath
 
PDF
Introduction to JRuby
elliando dias
 
PDF
Fighting Ruby code smell
olegshpynov
 
PHP and node.js Together
Chris Tankersley
 
Javascript Frameworks Comparison
Deepu S Nath
 
Proxying DBI with DBD::Gofer and App::Staticperl
nohuhu
 
Web development basics (Part-3)
Rajat Pratap Singh
 
Developing cross platform desktop application with Ruby
Anis Ahmad
 
[Mas 500] Intro to Programming
rahulbot
 
Evolution of java script libraries
Columbia Developers Guild
 
Ruby, the language of devops
Rob Kinyon
 
FGCU Camp Talk
Mark Brooks
 
RubyMotion #jbday
Dennis Ushakov
 
Ruby projects of interest for DevOps
Ricardo Sanchez
 
Delayed operations with queues for website performance
OSInet
 
Webpack & EcmaScript 6 (Webelement #32)
srigi
 
Node.js 201: building real-world applications in pure JavaScript
Tom Boutell
 
Ruby application based on http
Richard Huang
 
Web development basics (Part-2)
Rajat Pratap Singh
 
GDI WordPress 1 January 2012
pamselle
 
Introduction to JS frameworks
Deepu S Nath
 
Introduction to JRuby
elliando dias
 
Fighting Ruby code smell
olegshpynov
 

Similar to Introduction to rails (20)

PPT
Introduction to Ruby on Rails
Manoj Kumar
 
PDF
Introduction to Rails - presented by Arman Ortega
arman o
 
PDF
Ruby Rails Web Development
Sonia Simi
 
PDF
Aspose pdf
Jim Jones
 
PPTX
Rubyonrails 120409061835-phpapp02
sagaroceanic11
 
KEY
Supa fast Ruby + Rails
Jean-Baptiste Feldis
 
PDF
Lecture #5 Introduction to rails
Evgeniy Hinyuk
 
PDF
Introduction to Rails by Evgeniy Hinyuk
Pivorak MeetUp
 
PPT
Ruby on Rails introduction
Tran Hung
 
PDF
RoR (Ruby on Rails)
scandiweb
 
PDF
Ruby On Rails Basics
Amit Solanki
 
PPT
Ruby On Rails Tutorial
sunniboy
 
PDF
Ruby On Rails Starter Kit
El Orabi Mohamed Ikbal
 
PPT
Intro for RoR
Vigneshwaran Seetharaman
 
PPTX
Ruby on Rails - An overview
Thomas Asikis
 
KEY
Intro to Ruby on Rails
rschmukler
 
PDF
Ruby on Rails 101 - Presentation Slides for a Five Day Introductory Course
peter_marklund
 
PDF
Ruby Rails Overview
Netguru
 
PDF
Introduction to Ruby on Rails
Alessandro DS
 
PDF
Ruby On Rails
anides
 
Introduction to Ruby on Rails
Manoj Kumar
 
Introduction to Rails - presented by Arman Ortega
arman o
 
Ruby Rails Web Development
Sonia Simi
 
Aspose pdf
Jim Jones
 
Rubyonrails 120409061835-phpapp02
sagaroceanic11
 
Supa fast Ruby + Rails
Jean-Baptiste Feldis
 
Lecture #5 Introduction to rails
Evgeniy Hinyuk
 
Introduction to Rails by Evgeniy Hinyuk
Pivorak MeetUp
 
Ruby on Rails introduction
Tran Hung
 
RoR (Ruby on Rails)
scandiweb
 
Ruby On Rails Basics
Amit Solanki
 
Ruby On Rails Tutorial
sunniboy
 
Ruby On Rails Starter Kit
El Orabi Mohamed Ikbal
 
Ruby on Rails - An overview
Thomas Asikis
 
Intro to Ruby on Rails
rschmukler
 
Ruby on Rails 101 - Presentation Slides for a Five Day Introductory Course
peter_marklund
 
Ruby Rails Overview
Netguru
 
Introduction to Ruby on Rails
Alessandro DS
 
Ruby On Rails
anides
 
Ad

Recently uploaded (20)

PDF
AI + DevOps = Smart Automation with devseccops.ai.pdf
Devseccops.ai
 
PPTX
Finding Your License Details in IBM SPSS Statistics Version 31.pptx
Version 1 Analytics
 
PDF
Digger Solo: Semantic search and maps for your local files
seanpedersen96
 
PDF
Technical-Careers-Roadmap-in-Software-Market.pdf
Hussein Ali
 
PPTX
Tally software_Introduction_Presentation
AditiBansal54083
 
PDF
Automate Cybersecurity Tasks with Python
VICTOR MAESTRE RAMIREZ
 
PPTX
Foundations of Marketo Engage - Powering Campaigns with Marketo Personalization
bbedford2
 
PPTX
Milwaukee Marketo User Group - Summer Road Trip: Mapping and Personalizing Yo...
bbedford2
 
PDF
MiniTool Partition Wizard Free Crack + Full Free Download 2025
bashirkhan333g
 
PDF
Wondershare PDFelement Pro Crack for MacOS New Version Latest 2025
bashirkhan333g
 
PPTX
OpenChain @ OSS NA - In From the Cold: Open Source as Part of Mainstream Soft...
Shane Coughlan
 
PDF
4K Video Downloader Plus Pro Crack for MacOS New Download 2025
bashirkhan333g
 
PDF
SciPy 2025 - Packaging a Scientific Python Project
Henry Schreiner
 
PDF
Open Chain Q2 Steering Committee Meeting - 2025-06-25
Shane Coughlan
 
PDF
vMix Pro 28.0.0.42 Download vMix Registration key Bundle
kulindacore
 
PDF
Generic or Specific? Making sensible software design decisions
Bert Jan Schrijver
 
PDF
[Solution] Why Choose the VeryPDF DRM Protector Custom-Built Solution for You...
Lingwen1998
 
PDF
Driver Easy Pro 6.1.1 Crack Licensce key 2025 FREE
utfefguu
 
PDF
How to Hire AI Developers_ Step-by-Step Guide in 2025.pdf
DianApps Technologies
 
PPTX
Home Care Tools: Benefits, features and more
Third Rock Techkno
 
AI + DevOps = Smart Automation with devseccops.ai.pdf
Devseccops.ai
 
Finding Your License Details in IBM SPSS Statistics Version 31.pptx
Version 1 Analytics
 
Digger Solo: Semantic search and maps for your local files
seanpedersen96
 
Technical-Careers-Roadmap-in-Software-Market.pdf
Hussein Ali
 
Tally software_Introduction_Presentation
AditiBansal54083
 
Automate Cybersecurity Tasks with Python
VICTOR MAESTRE RAMIREZ
 
Foundations of Marketo Engage - Powering Campaigns with Marketo Personalization
bbedford2
 
Milwaukee Marketo User Group - Summer Road Trip: Mapping and Personalizing Yo...
bbedford2
 
MiniTool Partition Wizard Free Crack + Full Free Download 2025
bashirkhan333g
 
Wondershare PDFelement Pro Crack for MacOS New Version Latest 2025
bashirkhan333g
 
OpenChain @ OSS NA - In From the Cold: Open Source as Part of Mainstream Soft...
Shane Coughlan
 
4K Video Downloader Plus Pro Crack for MacOS New Download 2025
bashirkhan333g
 
SciPy 2025 - Packaging a Scientific Python Project
Henry Schreiner
 
Open Chain Q2 Steering Committee Meeting - 2025-06-25
Shane Coughlan
 
vMix Pro 28.0.0.42 Download vMix Registration key Bundle
kulindacore
 
Generic or Specific? Making sensible software design decisions
Bert Jan Schrijver
 
[Solution] Why Choose the VeryPDF DRM Protector Custom-Built Solution for You...
Lingwen1998
 
Driver Easy Pro 6.1.1 Crack Licensce key 2025 FREE
utfefguu
 
How to Hire AI Developers_ Step-by-Step Guide in 2025.pdf
DianApps Technologies
 
Home Care Tools: Benefits, features and more
Third Rock Techkno
 
Ad

Introduction to rails

  • 1. Introduction to Ruby on Rails (aka: Rails for you) Go Frendi Gunawan
  • 2. About Me ● Go Frendi Gunawan ● Developer of No-CMS and Kokoropy ● Lecturer at STIKI Malang ● Starting a startup business ● http://gofrendiasgard.github.io
  • 3. Ruby ● A fully OOP programming language ● Created by Yukihiro Matsumoto (Matz) ● Influenced by Python, Perl, dan Java ● Easy to write ● A bit hard to read ● Easy and fun to learn (http://tryruby.org) ● Has interactive console called “irb” ● Has package control library called “gem”
  • 4. Ruby – Variable ● Don't need to implicitly write datatype a = 5 b = “Some string”
  • 5. Ruby – Block ● You can use “end” keyword, no curly braces as in C or Java: # branch if 3>4 puts “She hates me” else puts “She loves me” end # loop i = 5 while i>0 puts i i = i-1 end
  • 6. Ruby – Function & Function Call ● Define a function: def add(a,b) a+b end ● This will works: add 4,5 as well as this: add(4,5)
  • 7. Ruby – Everything is object ● No primitive datatype like java ● This will yield “Hello world!”: “!dlrow elloH”.reverse A string like “!dlrow elloH” has reverse method, you don't even need to put it in a variable ● This will yield 8: 7.next ● This will blow up your mind: [1,2,3,4,5].each{|num| puts num+1} It is like foreach in php. You iterate through the array, put each element into a local variable called “num” and print num+1 into the screen.
  • 8. Ruby-Class & Object ● Define a class class Scientist def initialize(name) @name = name end def introduce() puts “My name is ” +@name end end ● Define an subclass class Mad_Scientist < Scientist end ● Make object sheldon = Scientist.new(“Sheldon Cooper”) sheldon.introduce
  • 9. Rails ● A very good web framework ● Full of “auto-magic” functionality ● Created by David Heinemeier Hansson ● Has several philosophy: – DRY (Don't Repeat Yourself) – MVC (Model View Controller) – Convention ofer Configuration (CoC) ● Powering several big websites: – Github – Twitter – Shopify
  • 10. Installing Rails ● If you are using linux or Mac, you can follow installation steps in http://rubyonrails.org/download/ FYI: you can even use apt-get in ubuntu. ● Windows user simply use this: http://railsftw.bryanbibat.net/ to save all the pain of compiling things.
  • 11. Starting Rails ● Open rails console, type this: rails new YOUR_APP_NAME ● Rails will generate several files & folders for you. Basically, you only need to take attention on: – config – app/models – app/controllers – app/models ● Type rails s and fire your browser to http://localhost:3000
  • 12. Scaffolding – Rails's best feature ● Scaffold articles – Rails g scaffold articles title:string body:text ● Do “migration” (aka: create your database without touching it) – rake db:migrate ● Fire your browser to http://localhost:3000/articles and it is.
  • 13. Use bootstrap themes (1) ● Add some gems first. Open YOUR_APP_NAME/Gemfiles, add this: – gem 'therubyracer' – gem 'less-rails' – gem 'twitter-bootstrap-rails' ● Install the gems – bundle install
  • 14. Use bootstrap themes (2) ● install bootstrap – rails g bootstrap:install ● Override Layout – rails g bootstrap:layout application fixed -f ● Override article's theme – rails g bootstrap:themed articles -f ● See the result
  • 15. Here is what we made so far (Pretty cool for something we didn't even code...)
  • 16. Tips and Tricks ● If you want to change the view manually, just go to app/views folder ● If you want articles to be your homepage, then you can modify config/routes.rb and add this: – root :to => "articles#index"
  • 17. Further reading ● http://tryruby.org/ ● http://railsforzombies.org/ ● http://guides.rubyonrails.org/getting_started.html
  • 18. Conclusion ● You have see how Ruby-on-Rails can help you develop application (or at least prototype) easily. ● Rails is a great framework, it is very simple to make a working CRUD application. However, deeper understanding about the language and the framework is required if you want to build a serious application