SlideShare a Scribd company logo
Ruby On Rails
 BeijingLUG



by Nathaniel Brown
    April 2007
Overview
●
    Install Ruby
●
    Install Rails
●
    (Optional) Install Eclipse
●
    Talk about Ruby
●
    Talk about Rails
●
    Example Application
●
    Links to Resources
Install Ruby
●
    sudo apt-get install ruby irb ri rdoc
●
    If you want to install mongrel you will also have
    to install the dev packages.
●
    sudo apt-get install ruby1.8-dev build-essential
Install Ruby Gems
●
    wget : http://rubyforge.org/frs/download.php/17190/
●
    tar xzvf rubygems-0.9.2.tgz
●
    cd rubygems-0.9.2
●
    sudo ruby setup.rb
●
    cd ..
●
    rm -rf rubygems-0.9.2
Install Rails and Mongrel
●
    sudo gem install rails --include-dependencies
●
    (Optional) sudo gem install mongrel --include-
    dependencies
●
    (Optional) Select the latest version of each
    library.
Install MySQL Server
●
    You could use PostgreSQL or SQLite instead
    but most examples use MySQL so we will as
    well.
●
    sudo apt-get install mysql-server phpmyadmin
    libmysql-ruby apache2 libapache2-mod-php5
(Optional) Install Eclipse
●
    sudo apt-get install eclipse sun-java5-jdk sun-
    java5-fonts
(Optional) Install RDT, RadRails and
       Aptana and Subclipse
●
    Open Eclipse and go to Help ->Software Updates
    -> Find and Install...
●
    Select “Search for new features to install” then
    click on “Next”.
●
    Add the following remote sites:
    RDT : http://updatesite.rubypeople.org/release
    RadRails : http://radrails.sourceforge.net/update
    Aptana : http://update.aptana.com/install/
    Subclipse : http://subclipse.tigris.org/update_1.2.x
●
    Once they have been added install all of them.
(Optional) Config RDT and RadRails
●
    Open Eclipse and go to Windows ->
    Preferences
●
    Find Ruby and add the Ruby interpreter.
●
    Find Rails and add the applications. They
    should all be in /usr/bin/*app name*
Ruby is a nice language
●
    Object Orientated
●
    Automatic garbage collection
●
    Sane readable code that makes sense.
Ruby example code 1
●
    Is readable

    puts "leon".reverse.capitalize

    staff_list = ["joe", "steve", "bob"]
    staff_list.sort!
    staff_list.each do |first_name|
     puts first_name.capitalize
    end

    3.times do |zork| puts "#{zork} " end
Ruby example code 2
−Tells       you if it will change the variable.
my_string = "12345"
new_string = my_string.chop
puts "String chopped."
puts "my_string: #{my_string}"
puts "new_string: #{new_string}"

my_string = "98765"
puts "my_string: #{my_string}"
my_string.chop!
puts "String chopped."
puts "my_string: #{my_string}"

my_number = 999474
puts my_number.to_s.include?("94")

my_string = "This is a test."
puts "#{my_string[3..5]}"
puts "#{my_string[2]}"
my_string[10..13] = "Ruby"
puts my_string
Ruby example code 3

−Lots      of things are just done really nicely.
#create our thread array
threads = []

5.times do |i|
  #create 5 threads into the array        
  threads[i] = Thread.new do
    #wait a random amount of time, then print a message
    sleep(rand(10))
    puts "I am thread number #{i}"
  end
end

#let each thread finish before ending the program
threads.each {|t| t.join}
Rails is a nice Framework
●
    Rapid Application Development
●
    Caching
●
    Model View Controller
●
    Nice informative errors

●
    DRY – Don't Repeat Yourself.
●
    Convention over Configuration
Rails supports modern features
●
    AJAX is build into the framework but JavaScript
    isn't required.
●
    Pretty URLs
●
    Active Record which is a type of Object
    Relation Mapping (ORM)
Rails encourages good
           development practices
●
    Validation
●
    Unit testing
●
    Use of development, testing and production
    environments with sane settings for each of
    them. e.g. Development has caching turned off.
    Production and Testing have it turned on.
●
    Version control is encouraged and assumed.
The Bad
●
    No manual only books.
●
    Ruby is relatively slow. (See Language Shoot-
    out)
●
    Rails is database driven which means it scales
    with the database.
●
    You'll often have to do things the “Rails Way”.
    (But it's often the right way as well)
●
    Lots of the 3rd party libraries are still unstable.
    (Improving quickly)
Create Your First Rails Applications
●
    If you are reading this online then go to the links
    section find RadRail's home page. He has a
    fairly good tutorial using RadRails.
Resources Links
●
    Rails for Fedora -
    http://digitalmediaminute.com/howto/fc4rails/
●
    RDT - http://rubyeclipse.sourceforge.net/
●
    RadRails and Aptana - http://www.radrails.org/
●
    Language Shoot-out -
    http://shootout.alioth.debian.org/
Cheat Sheets Links
●
    Rails, CSS, Javascript, HTML, etc (A4) -
    http://www.ilovejackdaniels.com/
●
    Nice Rails summary -
    http://www.blainekendall.com/index.php/rubyonrails
●
    A couple of Rails Cheat Sheets -
    http://www.slash7.com/goodies
Rails Links
●
    Ruby - http://www.ruby-lang.org/en/
●
    Ruby on Rails - http://www.rubyonrails.org/
●
    Ruby Forge - http://rubyforge.org/
●
    Free Ruby manual - http://www.poignantguide.net/ruby/
●
    Rails and Caching -
    http://www.railsenvy.com/2007/2/28/rails-caching-tutorial
●
    Ruby On Rails to exe -
    http://www.erikveen.dds.nl/distributingrubyapplications/rails.html
●
    Rails Tricks -
    http://www.rubyinside.com/19-rails-tricks-most-rails-coders-dont-kno
●
    Rails Deployment -
    http://manuals.rubyonrails.com/read/book/17

More Related Content

PDF
Ruby projects of interest for DevOps
PPTX
Ruby, the language of devops
KEY
Impression of Rails 3
KEY
tDiary annual report 2009 - Sapporo Ruby Kaigi02
KEY
Prototypejs
KEY
Rails with mongodb
PDF
How to develop the Standard Libraries of Ruby?
ODP
How to add Fixtures into your Django app with Mixer
Ruby projects of interest for DevOps
Ruby, the language of devops
Impression of Rails 3
tDiary annual report 2009 - Sapporo Ruby Kaigi02
Prototypejs
Rails with mongodb
How to develop the Standard Libraries of Ruby?
How to add Fixtures into your Django app with Mixer

What's hot (19)

PDF
What's new in RubyGems3
PPTX
I18nize Scala programs à la gettext
PPTX
Automating Your Daily Tasks with Scripting - RubyConf 2015 Taiwan
PDF
The Future of Bundled Bundler
PDF
Introduction to rails
PDF
The Future of library dependency management of Ruby
PDF
OSS Security the hard way
PPT
RubyMotion #jbday
PDF
ODP
rsyslog meets docker
PDF
Ruby Security the Hard Way
PDF
Fighting Ruby code smell
PDF
WTF Is Rancher?
PDF
遇見 Ruby on Rails
PPTX
Zap api and scripting - @iprav33nk
PDF
javerosmx-2015-marzo-groovy-java8-comparison
PDF
Crate Packaging Standalone Ruby Applications
PDF
Ruby Isn't Just About Rails
PDF
How to-node-core
What's new in RubyGems3
I18nize Scala programs à la gettext
Automating Your Daily Tasks with Scripting - RubyConf 2015 Taiwan
The Future of Bundled Bundler
Introduction to rails
The Future of library dependency management of Ruby
OSS Security the hard way
RubyMotion #jbday
rsyslog meets docker
Ruby Security the Hard Way
Fighting Ruby code smell
WTF Is Rancher?
遇見 Ruby on Rails
Zap api and scripting - @iprav33nk
javerosmx-2015-marzo-groovy-java8-comparison
Crate Packaging Standalone Ruby Applications
Ruby Isn't Just About Rails
How to-node-core
Ad

Viewers also liked (8)

PDF
Accessing_MySQL_from_Ruby
PDF
Devoxx%202008%20Tutorial
PDF
lab56_db
PDF
ruby-efl-tutorial-hsyl20
PDF
rails.html
PDF
has_many_and_belongs_to_many
PDF
wtst3_pettichord3
PDF
Difference between flyers, brochures, posters & leaflets
Accessing_MySQL_from_Ruby
Devoxx%202008%20Tutorial
lab56_db
ruby-efl-tutorial-hsyl20
rails.html
has_many_and_belongs_to_many
wtst3_pettichord3
Difference between flyers, brochures, posters & leaflets
Ad

Similar to rubyonrails (20)

PPTX
Ruby on Rails - An overview
PPTX
Rubyonrails 120409061835-phpapp02
PDF
Aspose pdf
PPT
Introduction To Rails
PPT
PDF
Ruby and Rails short motivation
KEY
Ruby on Rails survival guide of an aged Java developer
PPT
Intro To Ror
PDF
Ruby On Rails Basics
PDF
Ruby on Rails 101 - Presentation Slides for a Five Day Introductory Course
PDF
Ruby Rails Web Development.pdf
ODP
DiUS Computing Lca Rails Final
KEY
Why ruby and rails
PPT
Ruby on Rails (RoR) as a back-end processor for Apex
PDF
Install Ruby on Rails Like a Pro: Effortless Guide
KEY
An introduction to Rails 3
PPT
Ruby On Rails Seminar Basis Softexpo Feb2010
PDF
Ror Seminar With agilebd.org on 23 Jan09
PPT
Intro To Ror
PDF
Introduction to Rails - presented by Arman Ortega
Ruby on Rails - An overview
Rubyonrails 120409061835-phpapp02
Aspose pdf
Introduction To Rails
Ruby and Rails short motivation
Ruby on Rails survival guide of an aged Java developer
Intro To Ror
Ruby On Rails Basics
Ruby on Rails 101 - Presentation Slides for a Five Day Introductory Course
Ruby Rails Web Development.pdf
DiUS Computing Lca Rails Final
Why ruby and rails
Ruby on Rails (RoR) as a back-end processor for Apex
Install Ruby on Rails Like a Pro: Effortless Guide
An introduction to Rails 3
Ruby On Rails Seminar Basis Softexpo Feb2010
Ror Seminar With agilebd.org on 23 Jan09
Intro To Ror
Introduction to Rails - presented by Arman Ortega

More from tutorialsruby (20)

PDF
<img src="../i/r_14.png" />
PDF
TopStyle Help & <b>Tutorial</b>
PDF
The Art Institute of Atlanta IMD 210 Fundamentals of Scripting <b>...</b>
PDF
<img src="../i/r_14.png" />
PDF
<img src="../i/r_14.png" />
PDF
Standardization and Knowledge Transfer – INS0
PDF
xhtml_basics
PDF
xhtml_basics
PDF
xhtml-documentation
PDF
xhtml-documentation
PDF
0047ecaa6ea3e9ac0a13a2fe96f4de3bfd515c88f5d90c1fae79b956363d7f02c7fa060269
PDF
0047ecaa6ea3e9ac0a13a2fe96f4de3bfd515c88f5d90c1fae79b956363d7f02c7fa060269
PDF
HowTo_CSS
PDF
HowTo_CSS
PDF
BloggingWithStyle_2008
PDF
BloggingWithStyle_2008
PDF
cascadingstylesheets
PDF
cascadingstylesheets
<img src="../i/r_14.png" />
TopStyle Help & <b>Tutorial</b>
The Art Institute of Atlanta IMD 210 Fundamentals of Scripting <b>...</b>
<img src="../i/r_14.png" />
<img src="../i/r_14.png" />
Standardization and Knowledge Transfer – INS0
xhtml_basics
xhtml_basics
xhtml-documentation
xhtml-documentation
0047ecaa6ea3e9ac0a13a2fe96f4de3bfd515c88f5d90c1fae79b956363d7f02c7fa060269
0047ecaa6ea3e9ac0a13a2fe96f4de3bfd515c88f5d90c1fae79b956363d7f02c7fa060269
HowTo_CSS
HowTo_CSS
BloggingWithStyle_2008
BloggingWithStyle_2008
cascadingstylesheets
cascadingstylesheets

Recently uploaded (20)

PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
DOCX
The AUB Centre for AI in Media Proposal.docx
PPTX
MYSQL Presentation for SQL database connectivity
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
Spectral efficient network and resource selection model in 5G networks
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PPTX
sap open course for s4hana steps from ECC to s4
PDF
cuic standard and advanced reporting.pdf
PDF
Unlocking AI with Model Context Protocol (MCP)
PPTX
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
The AUB Centre for AI in Media Proposal.docx
MYSQL Presentation for SQL database connectivity
NewMind AI Weekly Chronicles - August'25 Week I
Diabetes mellitus diagnosis method based random forest with bat algorithm
Mobile App Security Testing_ A Comprehensive Guide.pdf
Spectral efficient network and resource selection model in 5G networks
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
sap open course for s4hana steps from ECC to s4
cuic standard and advanced reporting.pdf
Unlocking AI with Model Context Protocol (MCP)
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
Understanding_Digital_Forensics_Presentation.pptx
Agricultural_Statistics_at_a_Glance_2022_0.pdf
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Chapter 3 Spatial Domain Image Processing.pdf
The Rise and Fall of 3GPP – Time for a Sabbatical?
“AI and Expert System Decision Support & Business Intelligence Systems”
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf

rubyonrails

  • 1. Ruby On Rails BeijingLUG by Nathaniel Brown April 2007
  • 2. Overview ● Install Ruby ● Install Rails ● (Optional) Install Eclipse ● Talk about Ruby ● Talk about Rails ● Example Application ● Links to Resources
  • 3. Install Ruby ● sudo apt-get install ruby irb ri rdoc ● If you want to install mongrel you will also have to install the dev packages. ● sudo apt-get install ruby1.8-dev build-essential
  • 4. Install Ruby Gems ● wget : http://rubyforge.org/frs/download.php/17190/ ● tar xzvf rubygems-0.9.2.tgz ● cd rubygems-0.9.2 ● sudo ruby setup.rb ● cd .. ● rm -rf rubygems-0.9.2
  • 5. Install Rails and Mongrel ● sudo gem install rails --include-dependencies ● (Optional) sudo gem install mongrel --include- dependencies ● (Optional) Select the latest version of each library.
  • 6. Install MySQL Server ● You could use PostgreSQL or SQLite instead but most examples use MySQL so we will as well. ● sudo apt-get install mysql-server phpmyadmin libmysql-ruby apache2 libapache2-mod-php5
  • 7. (Optional) Install Eclipse ● sudo apt-get install eclipse sun-java5-jdk sun- java5-fonts
  • 8. (Optional) Install RDT, RadRails and Aptana and Subclipse ● Open Eclipse and go to Help ->Software Updates -> Find and Install... ● Select “Search for new features to install” then click on “Next”. ● Add the following remote sites: RDT : http://updatesite.rubypeople.org/release RadRails : http://radrails.sourceforge.net/update Aptana : http://update.aptana.com/install/ Subclipse : http://subclipse.tigris.org/update_1.2.x ● Once they have been added install all of them.
  • 9. (Optional) Config RDT and RadRails ● Open Eclipse and go to Windows -> Preferences ● Find Ruby and add the Ruby interpreter. ● Find Rails and add the applications. They should all be in /usr/bin/*app name*
  • 10. Ruby is a nice language ● Object Orientated ● Automatic garbage collection ● Sane readable code that makes sense.
  • 11. Ruby example code 1 ● Is readable puts "leon".reverse.capitalize staff_list = ["joe", "steve", "bob"] staff_list.sort! staff_list.each do |first_name| puts first_name.capitalize end 3.times do |zork| puts "#{zork} " end
  • 12. Ruby example code 2 −Tells you if it will change the variable. my_string = "12345" new_string = my_string.chop puts "String chopped." puts "my_string: #{my_string}" puts "new_string: #{new_string}" my_string = "98765" puts "my_string: #{my_string}" my_string.chop! puts "String chopped." puts "my_string: #{my_string}" my_number = 999474 puts my_number.to_s.include?("94") my_string = "This is a test." puts "#{my_string[3..5]}" puts "#{my_string[2]}" my_string[10..13] = "Ruby" puts my_string
  • 13. Ruby example code 3 −Lots of things are just done really nicely. #create our thread array threads = [] 5.times do |i|   #create 5 threads into the array           threads[i] = Thread.new do     #wait a random amount of time, then print a message     sleep(rand(10))     puts "I am thread number #{i}"   end end #let each thread finish before ending the program threads.each {|t| t.join}
  • 14. Rails is a nice Framework ● Rapid Application Development ● Caching ● Model View Controller ● Nice informative errors ● DRY – Don't Repeat Yourself. ● Convention over Configuration
  • 15. Rails supports modern features ● AJAX is build into the framework but JavaScript isn't required. ● Pretty URLs ● Active Record which is a type of Object Relation Mapping (ORM)
  • 16. Rails encourages good development practices ● Validation ● Unit testing ● Use of development, testing and production environments with sane settings for each of them. e.g. Development has caching turned off. Production and Testing have it turned on. ● Version control is encouraged and assumed.
  • 17. The Bad ● No manual only books. ● Ruby is relatively slow. (See Language Shoot- out) ● Rails is database driven which means it scales with the database. ● You'll often have to do things the “Rails Way”. (But it's often the right way as well) ● Lots of the 3rd party libraries are still unstable. (Improving quickly)
  • 18. Create Your First Rails Applications ● If you are reading this online then go to the links section find RadRail's home page. He has a fairly good tutorial using RadRails.
  • 19. Resources Links ● Rails for Fedora - http://digitalmediaminute.com/howto/fc4rails/ ● RDT - http://rubyeclipse.sourceforge.net/ ● RadRails and Aptana - http://www.radrails.org/ ● Language Shoot-out - http://shootout.alioth.debian.org/
  • 20. Cheat Sheets Links ● Rails, CSS, Javascript, HTML, etc (A4) - http://www.ilovejackdaniels.com/ ● Nice Rails summary - http://www.blainekendall.com/index.php/rubyonrails ● A couple of Rails Cheat Sheets - http://www.slash7.com/goodies
  • 21. Rails Links ● Ruby - http://www.ruby-lang.org/en/ ● Ruby on Rails - http://www.rubyonrails.org/ ● Ruby Forge - http://rubyforge.org/ ● Free Ruby manual - http://www.poignantguide.net/ruby/ ● Rails and Caching - http://www.railsenvy.com/2007/2/28/rails-caching-tutorial ● Ruby On Rails to exe - http://www.erikveen.dds.nl/distributingrubyapplications/rails.html ● Rails Tricks - http://www.rubyinside.com/19-rails-tricks-most-rails-coders-dont-kno ● Rails Deployment - http://manuals.rubyonrails.com/read/book/17