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

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

What's hot (20)

PHP and node.js Together
PHP and node.js TogetherPHP and node.js Together
PHP and node.js Together
 
Javascript Frameworks Comparison
Javascript Frameworks ComparisonJavascript Frameworks Comparison
Javascript Frameworks Comparison
 
Proxying DBI with DBD::Gofer and App::Staticperl
Proxying DBI with DBD::Gofer and App::StaticperlProxying DBI with DBD::Gofer and App::Staticperl
Proxying DBI with DBD::Gofer and App::Staticperl
 
Web development basics (Part-3)
Web development basics (Part-3)Web development basics (Part-3)
Web development basics (Part-3)
 
Developing cross platform desktop application with Ruby
Developing cross platform desktop application with RubyDeveloping cross platform desktop application with Ruby
Developing cross platform desktop application with Ruby
 
[Mas 500] Intro to Programming
[Mas 500] Intro to Programming[Mas 500] Intro to Programming
[Mas 500] Intro to Programming
 
Evolution of java script libraries
Evolution of java script librariesEvolution of java script libraries
Evolution of java script libraries
 
Ruby, the language of devops
Ruby, the language of devopsRuby, the language of devops
Ruby, the language of devops
 
FGCU Camp Talk
FGCU Camp TalkFGCU Camp Talk
FGCU Camp Talk
 
RubyMotion #jbday
RubyMotion #jbdayRubyMotion #jbday
RubyMotion #jbday
 
Ruby projects of interest for DevOps
Ruby projects of interest for DevOpsRuby projects of interest for DevOps
Ruby projects of interest for DevOps
 
Delayed operations with queues for website performance
Delayed operations with queues for website performanceDelayed operations with queues for website performance
Delayed operations with queues for website performance
 
Webpack & EcmaScript 6 (Webelement #32)
Webpack & EcmaScript 6 (Webelement #32)Webpack & EcmaScript 6 (Webelement #32)
Webpack & EcmaScript 6 (Webelement #32)
 
Node.js 201: building real-world applications in pure JavaScript
Node.js 201: building real-world applications in pure JavaScriptNode.js 201: building real-world applications in pure JavaScript
Node.js 201: building real-world applications in pure JavaScript
 
Ruby application based on http
Ruby application based on httpRuby application based on http
Ruby application based on http
 
Web development basics (Part-2)
Web development basics (Part-2)Web development basics (Part-2)
Web development basics (Part-2)
 
GDI WordPress 1 January 2012
GDI WordPress 1 January 2012GDI WordPress 1 January 2012
GDI WordPress 1 January 2012
 
Introduction to JS frameworks
Introduction to JS frameworksIntroduction to JS frameworks
Introduction to JS frameworks
 
Introduction to JRuby
Introduction to JRubyIntroduction to JRuby
Introduction to JRuby
 
Fighting Ruby code smell
Fighting Ruby code smellFighting Ruby code smell
Fighting Ruby code smell
 

Similar to Introduction to rails

RoR (Ruby on Rails)
RoR (Ruby on Rails)RoR (Ruby on Rails)
RoR (Ruby on Rails)
scandiweb
 
HTML, CSS & Javascript Architecture (extended version) - Jan Kraus
HTML, CSS & Javascript Architecture (extended version) - Jan KrausHTML, CSS & Javascript Architecture (extended version) - Jan Kraus
HTML, CSS & Javascript Architecture (extended version) - Jan Kraus
Women in Technology Poland
 
Hack Rio/OS
Hack Rio/OSHack Rio/OS
Hack Rio/OS
Kishore Neelamegam
 
rubyonrails
rubyonrailsrubyonrails
rubyonrails
tutorialsruby
 
rubyonrails
rubyonrailsrubyonrails
rubyonrails
tutorialsruby
 
Your First Scala Web Application using Play 2.1
Your First Scala Web Application using Play 2.1Your First Scala Web Application using Play 2.1
Your First Scala Web Application using Play 2.1
Matthew Barlocker
 
CoffeeScript: A beginner's presentation for beginners copy
CoffeeScript: A beginner's presentation for beginners copyCoffeeScript: A beginner's presentation for beginners copy
CoffeeScript: A beginner's presentation for beginners copy
Patrick Devins
 
2014 11 20 Drupal 7 -> 8 test migratie
2014 11 20 Drupal 7 -> 8 test migratie2014 11 20 Drupal 7 -> 8 test migratie
2014 11 20 Drupal 7 -> 8 test migratie
hcderaad
 
Architektura html, css i javascript - Jan Kraus
Architektura html, css i javascript - Jan KrausArchitektura html, css i javascript - Jan Kraus
Architektura html, css i javascript - Jan Kraus
Women in Technology Poland
 
20140408 tdd puppetcamp-paris
20140408 tdd puppetcamp-paris20140408 tdd puppetcamp-paris
20140408 tdd puppetcamp-paris
Johan De Wit
 
Puppet Camp Paris 2014: Test Driven Development
Puppet Camp Paris 2014: Test Driven DevelopmentPuppet Camp Paris 2014: Test Driven Development
Puppet Camp Paris 2014: Test Driven Development
Puppet
 
Exploring Ruby on Rails and PostgreSQL
Exploring Ruby on Rails and PostgreSQLExploring Ruby on Rails and PostgreSQL
Exploring Ruby on Rails and PostgreSQL
Barry Jones
 
Becoming A Drupal Master Builder
Becoming A Drupal Master BuilderBecoming A Drupal Master Builder
Becoming A Drupal Master Builder
Philip Norton
 
Efficient development workflows with composer
Efficient development workflows with composerEfficient development workflows with composer
Efficient development workflows with composer
nuppla
 
Daniel Steigerwald: EsteJS - javascriptové aplikace robusně, modulárně a komf...
Daniel Steigerwald: EsteJS - javascriptové aplikace robusně, modulárně a komf...Daniel Steigerwald: EsteJS - javascriptové aplikace robusně, modulárně a komf...
Daniel Steigerwald: EsteJS - javascriptové aplikace robusně, modulárně a komf...
Develcz
 
Presentation laravel 5 4
Presentation laravel 5 4Presentation laravel 5 4
Presentation laravel 5 4
Christen Gjølbye Christensen
 
Ruby on Rails - An overview
Ruby on Rails -  An overviewRuby on Rails -  An overview
Ruby on Rails - An overview
Thomas Asikis
 
Behat Workshop at WeLovePHP
Behat Workshop at WeLovePHPBehat Workshop at WeLovePHP
Behat Workshop at WeLovePHP
Marcos Quesada
 
Forensic Theming - DrupalCon London
Forensic Theming - DrupalCon LondonForensic Theming - DrupalCon London
Forensic Theming - DrupalCon London
Emma Jane Hogbin Westby
 
MobileConf 2021 Slides: Let's build macOS CLI Utilities using Swift
MobileConf 2021 Slides:  Let's build macOS CLI Utilities using SwiftMobileConf 2021 Slides:  Let's build macOS CLI Utilities using Swift
MobileConf 2021 Slides: Let's build macOS CLI Utilities using Swift
Diego Freniche Brito
 

Similar to Introduction to rails (20)

RoR (Ruby on Rails)
RoR (Ruby on Rails)RoR (Ruby on Rails)
RoR (Ruby on Rails)
 
HTML, CSS & Javascript Architecture (extended version) - Jan Kraus
HTML, CSS & Javascript Architecture (extended version) - Jan KrausHTML, CSS & Javascript Architecture (extended version) - Jan Kraus
HTML, CSS & Javascript Architecture (extended version) - Jan Kraus
 
Hack Rio/OS
Hack Rio/OSHack Rio/OS
Hack Rio/OS
 
rubyonrails
rubyonrailsrubyonrails
rubyonrails
 
rubyonrails
rubyonrailsrubyonrails
rubyonrails
 
Your First Scala Web Application using Play 2.1
Your First Scala Web Application using Play 2.1Your First Scala Web Application using Play 2.1
Your First Scala Web Application using Play 2.1
 
CoffeeScript: A beginner's presentation for beginners copy
CoffeeScript: A beginner's presentation for beginners copyCoffeeScript: A beginner's presentation for beginners copy
CoffeeScript: A beginner's presentation for beginners copy
 
2014 11 20 Drupal 7 -> 8 test migratie
2014 11 20 Drupal 7 -> 8 test migratie2014 11 20 Drupal 7 -> 8 test migratie
2014 11 20 Drupal 7 -> 8 test migratie
 
Architektura html, css i javascript - Jan Kraus
Architektura html, css i javascript - Jan KrausArchitektura html, css i javascript - Jan Kraus
Architektura html, css i javascript - Jan Kraus
 
20140408 tdd puppetcamp-paris
20140408 tdd puppetcamp-paris20140408 tdd puppetcamp-paris
20140408 tdd puppetcamp-paris
 
Puppet Camp Paris 2014: Test Driven Development
Puppet Camp Paris 2014: Test Driven DevelopmentPuppet Camp Paris 2014: Test Driven Development
Puppet Camp Paris 2014: Test Driven Development
 
Exploring Ruby on Rails and PostgreSQL
Exploring Ruby on Rails and PostgreSQLExploring Ruby on Rails and PostgreSQL
Exploring Ruby on Rails and PostgreSQL
 
Becoming A Drupal Master Builder
Becoming A Drupal Master BuilderBecoming A Drupal Master Builder
Becoming A Drupal Master Builder
 
Efficient development workflows with composer
Efficient development workflows with composerEfficient development workflows with composer
Efficient development workflows with composer
 
Daniel Steigerwald: EsteJS - javascriptové aplikace robusně, modulárně a komf...
Daniel Steigerwald: EsteJS - javascriptové aplikace robusně, modulárně a komf...Daniel Steigerwald: EsteJS - javascriptové aplikace robusně, modulárně a komf...
Daniel Steigerwald: EsteJS - javascriptové aplikace robusně, modulárně a komf...
 
Presentation laravel 5 4
Presentation laravel 5 4Presentation laravel 5 4
Presentation laravel 5 4
 
Ruby on Rails - An overview
Ruby on Rails -  An overviewRuby on Rails -  An overview
Ruby on Rails - An overview
 
Behat Workshop at WeLovePHP
Behat Workshop at WeLovePHPBehat Workshop at WeLovePHP
Behat Workshop at WeLovePHP
 
Forensic Theming - DrupalCon London
Forensic Theming - DrupalCon LondonForensic Theming - DrupalCon London
Forensic Theming - DrupalCon London
 
MobileConf 2021 Slides: Let's build macOS CLI Utilities using Swift
MobileConf 2021 Slides:  Let's build macOS CLI Utilities using SwiftMobileConf 2021 Slides:  Let's build macOS CLI Utilities using Swift
MobileConf 2021 Slides: Let's build macOS CLI Utilities using Swift
 

Recently uploaded

ACE - Team 24 Wrapup event at ahmedabad.
ACE - Team 24 Wrapup event at ahmedabad.ACE - Team 24 Wrapup event at ahmedabad.
ACE - Team 24 Wrapup event at ahmedabad.
Maitrey Patel
 
Mobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona InfotechMobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona Infotech
Drona Infotech
 
Liberarsi dai framework con i Web Component.pptx
Liberarsi dai framework con i Web Component.pptxLiberarsi dai framework con i Web Component.pptx
Liberarsi dai framework con i Web Component.pptx
Massimo Artizzu
 
Transforming Product Development using OnePlan To Boost Efficiency and Innova...
Transforming Product Development using OnePlan To Boost Efficiency and Innova...Transforming Product Development using OnePlan To Boost Efficiency and Innova...
Transforming Product Development using OnePlan To Boost Efficiency and Innova...
OnePlan Solutions
 
Why Apache Kafka Clusters Are Like Galaxies (And Other Cosmic Kafka Quandarie...
Why Apache Kafka Clusters Are Like Galaxies (And Other Cosmic Kafka Quandarie...Why Apache Kafka Clusters Are Like Galaxies (And Other Cosmic Kafka Quandarie...
Why Apache Kafka Clusters Are Like Galaxies (And Other Cosmic Kafka Quandarie...
Paul Brebner
 
Assure Contact Center Experiences for Your Customers With ThousandEyes
Assure Contact Center Experiences for Your Customers With ThousandEyesAssure Contact Center Experiences for Your Customers With ThousandEyes
Assure Contact Center Experiences for Your Customers With ThousandEyes
ThousandEyes
 
TMU毕业证书精仿办理
TMU毕业证书精仿办理TMU毕业证书精仿办理
TMU毕业证书精仿办理
aeeva
 
Modelling Up - DDDEurope 2024 - Amsterdam
Modelling Up - DDDEurope 2024 - AmsterdamModelling Up - DDDEurope 2024 - Amsterdam
Modelling Up - DDDEurope 2024 - Amsterdam
Alberto Brandolini
 
Orca: Nocode Graphical Editor for Container Orchestration
Orca: Nocode Graphical Editor for Container OrchestrationOrca: Nocode Graphical Editor for Container Orchestration
Orca: Nocode Graphical Editor for Container Orchestration
Pedro J. Molina
 
WWDC 2024 Keynote Review: For CocoaCoders Austin
WWDC 2024 Keynote Review: For CocoaCoders AustinWWDC 2024 Keynote Review: For CocoaCoders Austin
WWDC 2024 Keynote Review: For CocoaCoders Austin
Patrick Weigel
 
Malibou Pitch Deck For Its €3M Seed Round
Malibou Pitch Deck For Its €3M Seed RoundMalibou Pitch Deck For Its €3M Seed Round
Malibou Pitch Deck For Its €3M Seed Round
sjcobrien
 
Everything You Need to Know About X-Sign: The eSign Functionality of XfilesPr...
Everything You Need to Know About X-Sign: The eSign Functionality of XfilesPr...Everything You Need to Know About X-Sign: The eSign Functionality of XfilesPr...
Everything You Need to Know About X-Sign: The eSign Functionality of XfilesPr...
XfilesPro
 
DECODING JAVA THREAD DUMPS: MASTER THE ART OF ANALYSIS
DECODING JAVA THREAD DUMPS: MASTER THE ART OF ANALYSISDECODING JAVA THREAD DUMPS: MASTER THE ART OF ANALYSIS
DECODING JAVA THREAD DUMPS: MASTER THE ART OF ANALYSIS
Tier1 app
 
Measures in SQL (SIGMOD 2024, Santiago, Chile)
Measures in SQL (SIGMOD 2024, Santiago, Chile)Measures in SQL (SIGMOD 2024, Santiago, Chile)
Measures in SQL (SIGMOD 2024, Santiago, Chile)
Julian Hyde
 
All you need to know about Spring Boot and GraalVM
All you need to know about Spring Boot and GraalVMAll you need to know about Spring Boot and GraalVM
All you need to know about Spring Boot and GraalVM
Alina Yurenko
 
🏎️Tech Transformation: DevOps Insights from the Experts 👩‍💻
🏎️Tech Transformation: DevOps Insights from the Experts 👩‍💻🏎️Tech Transformation: DevOps Insights from the Experts 👩‍💻
🏎️Tech Transformation: DevOps Insights from the Experts 👩‍💻
campbellclarkson
 
Unlock the Secrets to Effortless Video Creation with Invideo: Your Ultimate G...
Unlock the Secrets to Effortless Video Creation with Invideo: Your Ultimate G...Unlock the Secrets to Effortless Video Creation with Invideo: Your Ultimate G...
Unlock the Secrets to Effortless Video Creation with Invideo: Your Ultimate G...
The Third Creative Media
 
ppt on the brain chip neuralink.pptx
ppt  on   the brain  chip neuralink.pptxppt  on   the brain  chip neuralink.pptx
ppt on the brain chip neuralink.pptx
Reetu63
 
Kubernetes at Scale: Going Multi-Cluster with Istio
Kubernetes at Scale:  Going Multi-Cluster  with IstioKubernetes at Scale:  Going Multi-Cluster  with Istio
Kubernetes at Scale: Going Multi-Cluster with Istio
Severalnines
 
WMF 2024 - Unlocking the Future of Data Powering Next-Gen AI with Vector Data...
WMF 2024 - Unlocking the Future of Data Powering Next-Gen AI with Vector Data...WMF 2024 - Unlocking the Future of Data Powering Next-Gen AI with Vector Data...
WMF 2024 - Unlocking the Future of Data Powering Next-Gen AI with Vector Data...
Luigi Fugaro
 

Recently uploaded (20)

ACE - Team 24 Wrapup event at ahmedabad.
ACE - Team 24 Wrapup event at ahmedabad.ACE - Team 24 Wrapup event at ahmedabad.
ACE - Team 24 Wrapup event at ahmedabad.
 
Mobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona InfotechMobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona Infotech
 
Liberarsi dai framework con i Web Component.pptx
Liberarsi dai framework con i Web Component.pptxLiberarsi dai framework con i Web Component.pptx
Liberarsi dai framework con i Web Component.pptx
 
Transforming Product Development using OnePlan To Boost Efficiency and Innova...
Transforming Product Development using OnePlan To Boost Efficiency and Innova...Transforming Product Development using OnePlan To Boost Efficiency and Innova...
Transforming Product Development using OnePlan To Boost Efficiency and Innova...
 
Why Apache Kafka Clusters Are Like Galaxies (And Other Cosmic Kafka Quandarie...
Why Apache Kafka Clusters Are Like Galaxies (And Other Cosmic Kafka Quandarie...Why Apache Kafka Clusters Are Like Galaxies (And Other Cosmic Kafka Quandarie...
Why Apache Kafka Clusters Are Like Galaxies (And Other Cosmic Kafka Quandarie...
 
Assure Contact Center Experiences for Your Customers With ThousandEyes
Assure Contact Center Experiences for Your Customers With ThousandEyesAssure Contact Center Experiences for Your Customers With ThousandEyes
Assure Contact Center Experiences for Your Customers With ThousandEyes
 
TMU毕业证书精仿办理
TMU毕业证书精仿办理TMU毕业证书精仿办理
TMU毕业证书精仿办理
 
Modelling Up - DDDEurope 2024 - Amsterdam
Modelling Up - DDDEurope 2024 - AmsterdamModelling Up - DDDEurope 2024 - Amsterdam
Modelling Up - DDDEurope 2024 - Amsterdam
 
Orca: Nocode Graphical Editor for Container Orchestration
Orca: Nocode Graphical Editor for Container OrchestrationOrca: Nocode Graphical Editor for Container Orchestration
Orca: Nocode Graphical Editor for Container Orchestration
 
WWDC 2024 Keynote Review: For CocoaCoders Austin
WWDC 2024 Keynote Review: For CocoaCoders AustinWWDC 2024 Keynote Review: For CocoaCoders Austin
WWDC 2024 Keynote Review: For CocoaCoders Austin
 
Malibou Pitch Deck For Its €3M Seed Round
Malibou Pitch Deck For Its €3M Seed RoundMalibou Pitch Deck For Its €3M Seed Round
Malibou Pitch Deck For Its €3M Seed Round
 
Everything You Need to Know About X-Sign: The eSign Functionality of XfilesPr...
Everything You Need to Know About X-Sign: The eSign Functionality of XfilesPr...Everything You Need to Know About X-Sign: The eSign Functionality of XfilesPr...
Everything You Need to Know About X-Sign: The eSign Functionality of XfilesPr...
 
DECODING JAVA THREAD DUMPS: MASTER THE ART OF ANALYSIS
DECODING JAVA THREAD DUMPS: MASTER THE ART OF ANALYSISDECODING JAVA THREAD DUMPS: MASTER THE ART OF ANALYSIS
DECODING JAVA THREAD DUMPS: MASTER THE ART OF ANALYSIS
 
Measures in SQL (SIGMOD 2024, Santiago, Chile)
Measures in SQL (SIGMOD 2024, Santiago, Chile)Measures in SQL (SIGMOD 2024, Santiago, Chile)
Measures in SQL (SIGMOD 2024, Santiago, Chile)
 
All you need to know about Spring Boot and GraalVM
All you need to know about Spring Boot and GraalVMAll you need to know about Spring Boot and GraalVM
All you need to know about Spring Boot and GraalVM
 
🏎️Tech Transformation: DevOps Insights from the Experts 👩‍💻
🏎️Tech Transformation: DevOps Insights from the Experts 👩‍💻🏎️Tech Transformation: DevOps Insights from the Experts 👩‍💻
🏎️Tech Transformation: DevOps Insights from the Experts 👩‍💻
 
Unlock the Secrets to Effortless Video Creation with Invideo: Your Ultimate G...
Unlock the Secrets to Effortless Video Creation with Invideo: Your Ultimate G...Unlock the Secrets to Effortless Video Creation with Invideo: Your Ultimate G...
Unlock the Secrets to Effortless Video Creation with Invideo: Your Ultimate G...
 
ppt on the brain chip neuralink.pptx
ppt  on   the brain  chip neuralink.pptxppt  on   the brain  chip neuralink.pptx
ppt on the brain chip neuralink.pptx
 
Kubernetes at Scale: Going Multi-Cluster with Istio
Kubernetes at Scale:  Going Multi-Cluster  with IstioKubernetes at Scale:  Going Multi-Cluster  with Istio
Kubernetes at Scale: Going Multi-Cluster with Istio
 
WMF 2024 - Unlocking the Future of Data Powering Next-Gen AI with Vector Data...
WMF 2024 - Unlocking the Future of Data Powering Next-Gen AI with Vector Data...WMF 2024 - Unlocking the Future of Data Powering Next-Gen AI with Vector Data...
WMF 2024 - Unlocking the Future of Data Powering Next-Gen AI with Vector Data...
 

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