SlideShare a Scribd company logo
An  INTRODUCTION   to  Ruby on Rails Nguyen Vu Hung [email_address] 2010/05/05
Agenda Ruby – The language. Ruby on Rails
Ruby – The language Made in Japan Creator:  まつもとゆきひろ Influenced by Perl, Smalltalk, Eiffel and Lisp. Multi-paradigm programming  language: Functional, Object oriented, Imperative and Reflective. Dynamic and automatic memory management.  Written in C Single-pass interpreted language (CLI, Interactive Ruby Shell)
まつもとゆきひろ Yukihiro Matsumoto 松本行弘 Born 1965 Computer scientist Programmer Compiler
Ruby influenced by Perl CLI Scripting language Simple Smalltalk Object-oriented Dynamically typed Reflective Can observe and modify its own structure and behavior Eiffel Lisp Originally specified in 1958 Fully parenthesized syntax
Functional language Emphasizes the application of functions. Everything is a function. class Array  def  iterate (code)  self.each_with_index do |n, i|    self[i] = code.call(n)  end  end  end  array = [1, 2, 3, 4]  array. iterate (l ambda  { |n| n ** 2 })  puts array.inspect  # => [1, 4, 9, 16]
Object oriented Similar to Java, PHP, Perl end end Point.new(@x*scalar, @y*scalar) def *(scalar)  # To perform scalar multiplication Point.new(-@x, -@y) end def -@  # Define unary minus to negate x and y Point.new(@x + other.x, @y + other.y) end def +(other)  # Define + to do vector addition @x,@y = x, y end Class Point attr_reader :x, :y  # Define accessor methods
Imperative Language TBD
Reflective Language TBD TBD: Java Reflection.
Ruby on Rails Open source   web application framework MIT license. Used with  Agile development methodology Rail architecture A MVC model Scaffolding : Automatically creates a skeleton of a basic website. WEBrick. Mongrel: Web servers. Rake: A build system. Test-Driven ActiveRecord   An  object-relational mapping  system for database access
Rails architecture: MVC
Rails architecture: 3-tier, N-tier? http://picasaweb.google.com/Dikiwinky/Ruby#5116531304417868130
Rails architecture: MVC Q: Where is M, V and C?
Ruby Agile Development Iterative development. Self organized.  Cross-functional team. Leadership philosophy: No real leader. Frequent inspection and adaptation. Allow high-quality. Rapid delivery.
Ruby  Scaffolding Generate source as needed-> Create a database (cookbook) Configure /config/database.yml  Generate source code: ruby script/generate scaffold Recipe title:string chef:string instructions:text
exists app/models/ exists app/controllers/  exists app/helpers/ create app/views/recipes  exists app/views/layouts/ exists test/functional/  exists test/unit/ exists public/stylesheets/  create app/views/recipes/index.html.erb  create app/views/recipes/show.html.erb  create app/views/recipes/new.html.erb  create app/views/recipes/edit.html.erb  create app/views/layouts/recipes.html.erb  create public/stylesheets/scaffold.css  create app/controllers/recipes_controller.rb  create test/functional/recipes_controller_test.rb  create app/helpers/recipes_helper.rb  route map.resources :recipes  dependency model exists  app/models/ exists test/unit/ exists  test/fixtures/ create app/models/recipe.rb  create test/unit/recipe_test.rb  create test/fixtures/recipes.yml  create db/migrate  create db/migrate/20080614192220_create_recipes.rb
exists app/models/  exists app/controllers/  exists app/helpers/  create app/views/recipes  exists app/views/layouts/ exists test/functional/  exists test/unit/ exists public/stylesheets/  create app/views/recipes/index.html.erb  create app/views/recipes/show.html.erb  create app/views/recipes/new.html.erb  create app/views/recipes/edit.html.erb  create app/views/layouts/recipes.html.erb  create public/stylesheets/scaffold.css  create app/controllers/recipes_controller.rb  create test/functional/recipes_controller_test.rb  create app/helpers/recipes_helper.rb  route map.resources :recipes  dependency model exists  app/models/ exists test/unit/ exists  test/fixtures/ create app/models/recipe.rb  create test/unit/recipe_test.rb  create test/fixtures/recipes.yml  create db/migrate  create db/migrate/20080614192220_create_recipes.rb
Ruby, Rails Installation CentOS 5: yum install -y ruby yum install -y ruby-devel ruby-docs ruby-ri ruby-irb ruby-rdoc tar xzvf rubygems-1.3.1.tgz cd rubygems sudo ruby setup.rb  sudo gem update  sudo gem install rails  Windows http://rubyonrails.org/download
Gems installed on Server 123 [vuhung@vinicorp ~]$ sudo gem list *** LOCAL GEMS *** actionmailer  (2.3.5, 2.2.2) actionpack  (2.3.5, 2.2.2) activerecord (2.3.5, 2.2.2) activeresource  (2.3.5, 2.2.2) activesupport  (2.3.5, 2.2.2) eventmachine  (0.12.10) fastthread  (1.0.7) htmlentities  (4.2.0) json  (1.2.0) juggernaut  (0.5.8) passenger  (2.2.9) rack  (1.0.1) rails  (2.3.5, 2.2.2) rake  (0.8.7
Rake A software building tool (automatically).  Written in Ruby. Configuration file: Rakefiles, ruby syntax. Common task can be done by ruby blocks (make cannot). Rake GNU make
Test-Driven Development Test first Write test-cases first. Automatic test cases generation. Short development circle. Regression test. Automated unit test. “Test” folder generated by Rake.
A short tutorial [vuhung@vinicorp ~]$ irb irb(main):001:0> puts "Hello Worlds" Hello Worlds => nil irb(main):002:0> 3+2 => 5 irb(main):003:0> 3*2 => 6 irb(main):004:0> 3**2 => 9 irb(main):005:0> Math.sqrt(9) => 3.0 irb(main):006:0> a = 3**2 => 9 irb(main):007:0> b = 4**2 => 16 irb(main):008:0> Math.sqrt(a+b) => 5.0 irb(main):009:0>
Redmine Web based Project Management Application. Written in Ruby on Rails GPL v2 licensed (free software). Rake as build system.  Gems WEBrick Plenty of plugins available. Stable since 2009/11 to date. Supports various DB back-end after Rails.
Redmine Folder Structure (2) ls -1 /var/www/html/redmine/redmine-0.8.7 app config db doc extra files lang lib log public Rakefile script start_redmine.sh test tmp vendor
 
TODO http://www.railstutorial.org/book#top http://www.railstutorial.org/chapters/a-demo-app#top http://www.railstutorial.org/chapters/static-pages#top http://www.railstutorial.org/chapters/rails-flavored-ruby#top http://www.railstutorial.org/chapters/filling-in-the-layout#top http://www.railstutorial.org/chapters/modeling-and-viewing-users-one#top http://www.railstutorial.org/chapters/modeling-and-viewing-users-two#top http://www.railstutorial.org/chapters/sign-up#top http://www.railstutorial.org/chapters/sign-in-sign-out#top http://www.railstutorial.org/chapters/updating-showing-and-deleting-users#top
TODO http://www-users.math.umd.edu/~dcarrera/ruby/0.3/chp_01/strings.html http://www-users.math.umd.edu/~dcarrera/ruby/0.3/chp_01/strings.html http://www-users.math.umd.edu/~dcarrera/ruby/0.3/chp_01/objects.html http://www-users.math.umd.edu/~dcarrera/ruby/0.3/chp_01/variables.html http://www-users.math.umd.edu/~dcarrera/ruby/0.3/chp_01/programs.html http://www-users.math.umd.edu/~dcarrera/ruby/0.3/chp_01/tips.html http://www-users.math.umd.edu/~dcarrera/ruby/0.3/chp_02/loops.html http://www-users.math.umd.edu/~dcarrera/ruby/0.3/chp_02/user_input.html http://www-users.math.umd.edu/~dcarrera/ruby/0.3/chp_02/conditionals.html http://www-users.math.umd.edu/~dcarrera/ruby/0.3/chp_02/tips.html http://www-users.math.umd.edu/~dcarrera/ruby/0.3/chp_03/arrays.html http://www-users.math.umd.edu/~dcarrera/ruby/0.3/chp_03/iterators.html http://www-users.math.umd.edu/~dcarrera/ruby/0.3/chp_03/hashes.html http://www-users.math.umd.edu/~dcarrera/ruby/0.3/chp_03/address.html http://www-users.math.umd.edu/~dcarrera/ruby/0.3/chp_03/address2.html http://www-users.math.umd.edu/~dcarrera/ruby/0.3/chp_03/sorting.html http://www-users.math.umd.edu/~dcarrera/ruby/0.3/chp_04/classes.html http://www-users.math.umd.edu/~dcarrera/ruby/0.3/chp_03/address2.html http://www-users.math.umd.edu/~dcarrera/ruby/0.3/chp_03/sorting.html http://www-users.math.umd.edu/~dcarrera/ruby/0.3/chp_04/functions.html http://www-users.math.umd.edu/~dcarrera/ruby/0.3/chp_04/classes.html http://www-users.math.umd.edu/~dcarrera/ruby/0.3/chp_04/classes2.html http://www-users.math.umd.edu/~dcarrera/ruby/0.3/chp_04/addressbook.html http://www-users.math.umd.edu/~dcarrera/ruby/0.3/chp_04/features.html
References http://en.wikipedia.org/wiki/Rapid_application_development http://en.wikipedia.org/wiki/Agile_software_development http://en.wikipedia.org/wiki/Yukihiro_Matsumoto http://en.wikipedia.org/wiki/Ruby_%28programming_language%29#Examples http://en.wikipedia.org/wiki/Ruby_%28programming_language%29 http://en.wikipedia.org/wiki/Ruby_on_Rails http://www.google.com/webhp?hl=en#hl=en&source=hp&q=ruby+functional+programming&aq=f&aqi=&aql=&oq=&gs_rfai=&fp=a86c207b1c79523e http://stackoverflow.com/questions/159797/is-ruby-a-functional-language http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/330387 http://stackoverflow.com/questions/546968/when-you-say-ruby-is-reflective-does-this-mainly-refer-to-duck-typing http://www.tutorialspoint.com/ruby/ruby_object_oriented.htm http://www.rubyist.net/~slagell/ruby/oothinking.html http://www.techotopia.com/index.php/Ruby_Object_Oriented_Programming http://d.hatena.ne.jp/shunsuk/20090101/1230816826 http://www.slideshare.net/peter_marklund/ruby-on-rails-101-presentation-slides-for-a-five-day-introductory-course http://picasaweb.google.com/Dikiwinky/Ruby#5116531304417868130 http://articles.slicehost.com/2009/4/7/centos-ruby-on-rails http://www.railstutorial.org/book

More Related Content

PPTX
Why Doesn't Java Has Instant Turnaround - Con-FESS 2012
KEY
Mashups with Drupal and QueryPath
PPT
Ruby On Rails Presentation
PDF
React Native custom components
PPT
Jasig Rubyon Rails
PPTX
JRuby in Java Projects
PPT
Why Doesn't Java Has Instant Turnaround - Con-FESS 2012
Mashups with Drupal and QueryPath
Ruby On Rails Presentation
React Native custom components
Jasig Rubyon Rails
JRuby in Java Projects

What's hot (20)

PDF
Symfony + GraphQL
PPTX
Graphql + Symfony | Александр Демченко | CODEiD
KEY
An Introduction to Ruby on Rails
PDF
Ruby On Rails
PDF
Alive and Well with Java 8
PDF
What's a macro?: Learning by Examples / Scalaのマクロに実用例から触れてみよう!
PPTX
Beginners' guide to Ruby on Rails
PPTX
Diving into Java Class Loader
PDF
The Dark Art of Rails Plugins (2008)
PDF
JavaScript - From Birth To Closure
PPTX
Software Uni Conf October 2014
PDF
Laravel and Django and Rails, Oh My!
PPTX
Lecture from javaday.bg by Nayden Gochev/ Ivan Ivanov and Mitia Alexandrov
PDF
Metaprogramming with javascript
PPTX
SoftwareUniversity seminar fast REST Api with Spring
PPTX
AngularConf2015
PDF
Effective Scala: Programming Patterns
PDF
Ruby Xml Mapping
PDF
Java Libraries You Can't Afford To Miss
Symfony + GraphQL
Graphql + Symfony | Александр Демченко | CODEiD
An Introduction to Ruby on Rails
Ruby On Rails
Alive and Well with Java 8
What's a macro?: Learning by Examples / Scalaのマクロに実用例から触れてみよう!
Beginners' guide to Ruby on Rails
Diving into Java Class Loader
The Dark Art of Rails Plugins (2008)
JavaScript - From Birth To Closure
Software Uni Conf October 2014
Laravel and Django and Rails, Oh My!
Lecture from javaday.bg by Nayden Gochev/ Ivan Ivanov and Mitia Alexandrov
Metaprogramming with javascript
SoftwareUniversity seminar fast REST Api with Spring
AngularConf2015
Effective Scala: Programming Patterns
Ruby Xml Mapping
Java Libraries You Can't Afford To Miss
Ad

Viewers also liked (14)

PPT
Boston Computing Review - Ruby on Rails
PDF
Intro To Swift
PDF
Ruby On Rails - 1. Ruby Introduction
PPT
Ruby on Rails introduction
PPT
Intro To Ror
ZIP
Ruby On Rails Presentation Barcamp Antwerp.Key
PPTX
Intro to Rails and MVC
PPT
Rochester on Rails: Introduction to Ruby
PDF
Introduction to Ruby on Rails
PPT
Introduction To Ruby On Rails
PPT
Introduction to Ruby on Rails
ODP
Introduction to Ruby on Rails
PDF
Web Development with Python and Django
PPTX
Introduction to Ruby on Rails
Boston Computing Review - Ruby on Rails
Intro To Swift
Ruby On Rails - 1. Ruby Introduction
Ruby on Rails introduction
Intro To Ror
Ruby On Rails Presentation Barcamp Antwerp.Key
Intro to Rails and MVC
Rochester on Rails: Introduction to Ruby
Introduction to Ruby on Rails
Introduction To Ruby On Rails
Introduction to Ruby on Rails
Introduction to Ruby on Rails
Web Development with Python and Django
Introduction to Ruby on Rails
Ad

Similar to An Introduction to Ruby on Rails 20100506 (20)

PDF
Connecting the Worlds of Java and Ruby with JRuby
PDF
Getting Started with Rails on GlassFish (Hands-on Lab) - Spark IT 2010
PPT
Ruby On Rails Tutorial
KEY
Supa fast Ruby + Rails
PDF
Getting Started with Rails
KEY
Ruby on Rails survival guide of an aged Java developer
PDF
Introduction to Rails - presented by Arman Ortega
PDF
JRuby, Ruby, Rails and You on the Cloud
PDF
JRuby + Rails = Awesome Java Web Framework at Jfokus 2011
PPT
Ruby On Rails Introduction
PDF
RoR 101: Session 2
PDF
Rspec and Capybara Intro Tutorial at RailsConf 2013
PDF
How to Begin to Develop Ruby Core
PDF
Building web framework with Rack
PDF
Ruby on rails探索
PDF
Ruby on Rails
PPTX
Why Ruby?
PPTX
Intro to Ruby on Rails
PDF
Ruby on Rails - Introduction
PPTX
Ruby on Rails : First Mile
Connecting the Worlds of Java and Ruby with JRuby
Getting Started with Rails on GlassFish (Hands-on Lab) - Spark IT 2010
Ruby On Rails Tutorial
Supa fast Ruby + Rails
Getting Started with Rails
Ruby on Rails survival guide of an aged Java developer
Introduction to Rails - presented by Arman Ortega
JRuby, Ruby, Rails and You on the Cloud
JRuby + Rails = Awesome Java Web Framework at Jfokus 2011
Ruby On Rails Introduction
RoR 101: Session 2
Rspec and Capybara Intro Tutorial at RailsConf 2013
How to Begin to Develop Ruby Core
Building web framework with Rack
Ruby on rails探索
Ruby on Rails
Why Ruby?
Intro to Ruby on Rails
Ruby on Rails - Introduction
Ruby on Rails : First Mile

More from Vu Hung Nguyen (20)

PPTX
Co ban horenso - Tai lieu training noi bo
PDF
Funix techtalk: Tự học hiệu quả thời 4.0
PDF
Học cờ cùng con - Nguyễn Vỹ Kỳ Anh [U8]
PDF
Japanese for it bridge engineers
PPTX
Basic IT Project Management Terminologies
PDF
2018 Học cờ cùng con - Nguyễn Vũ Kỳ Anh [U7]
PDF
Làm việc hiệu quả với sếp Nhật (2017)
PDF
Problem Solving Skills (for IT Engineers)
PPTX
Using Shader in cocos2d-x
PPTX
Pham Anh Tu - TK Framework
PDF
My idol: Magnus Carlsen vs. Ky Anh 2G1 NGS Newton
PDF
Basic advanced scrum framework
PDF
FPT Univ. Talkshow IT khong chi la lap trinh
PDF
Basic & Advanced Scrum Framework
PDF
Agile Vietnam Conference 2016: Recap
PDF
IT Public Speaking Guidelines
PDF
Kanban: Cơ bản và Nâng cao
PDF
Học cờ vua cùng con Nguyễn Vũ Kỳ Anh (U6)
PPTX
Fuji Technology Workshop: Learning Skills
PDF
Anti patterns in it project management
Co ban horenso - Tai lieu training noi bo
Funix techtalk: Tự học hiệu quả thời 4.0
Học cờ cùng con - Nguyễn Vỹ Kỳ Anh [U8]
Japanese for it bridge engineers
Basic IT Project Management Terminologies
2018 Học cờ cùng con - Nguyễn Vũ Kỳ Anh [U7]
Làm việc hiệu quả với sếp Nhật (2017)
Problem Solving Skills (for IT Engineers)
Using Shader in cocos2d-x
Pham Anh Tu - TK Framework
My idol: Magnus Carlsen vs. Ky Anh 2G1 NGS Newton
Basic advanced scrum framework
FPT Univ. Talkshow IT khong chi la lap trinh
Basic & Advanced Scrum Framework
Agile Vietnam Conference 2016: Recap
IT Public Speaking Guidelines
Kanban: Cơ bản và Nâng cao
Học cờ vua cùng con Nguyễn Vũ Kỳ Anh (U6)
Fuji Technology Workshop: Learning Skills
Anti patterns in it project management

Recently uploaded (20)

PPTX
Understanding_Digital_Forensics_Presentation.pptx
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PPT
Teaching material agriculture food technology
PDF
KodekX | Application Modernization Development
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PPTX
sap open course for s4hana steps from ECC to s4
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
cuic standard and advanced reporting.pdf
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PPTX
Programs and apps: productivity, graphics, security and other tools
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
DOCX
The AUB Centre for AI in Media Proposal.docx
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Understanding_Digital_Forensics_Presentation.pptx
The Rise and Fall of 3GPP – Time for a Sabbatical?
Teaching material agriculture food technology
KodekX | Application Modernization Development
Advanced methodologies resolving dimensionality complications for autism neur...
sap open course for s4hana steps from ECC to s4
Reach Out and Touch Someone: Haptics and Empathic Computing
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
Building Integrated photovoltaic BIPV_UPV.pdf
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
cuic standard and advanced reporting.pdf
Diabetes mellitus diagnosis method based random forest with bat algorithm
Programs and apps: productivity, graphics, security and other tools
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Encapsulation_ Review paper, used for researhc scholars
NewMind AI Weekly Chronicles - August'25 Week I
“AI and Expert System Decision Support & Business Intelligence Systems”
The AUB Centre for AI in Media Proposal.docx
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf

An Introduction to Ruby on Rails 20100506

  • 1. An INTRODUCTION to Ruby on Rails Nguyen Vu Hung [email_address] 2010/05/05
  • 2. Agenda Ruby – The language. Ruby on Rails
  • 3. Ruby – The language Made in Japan Creator: まつもとゆきひろ Influenced by Perl, Smalltalk, Eiffel and Lisp. Multi-paradigm programming language: Functional, Object oriented, Imperative and Reflective. Dynamic and automatic memory management. Written in C Single-pass interpreted language (CLI, Interactive Ruby Shell)
  • 4. まつもとゆきひろ Yukihiro Matsumoto 松本行弘 Born 1965 Computer scientist Programmer Compiler
  • 5. Ruby influenced by Perl CLI Scripting language Simple Smalltalk Object-oriented Dynamically typed Reflective Can observe and modify its own structure and behavior Eiffel Lisp Originally specified in 1958 Fully parenthesized syntax
  • 6. Functional language Emphasizes the application of functions. Everything is a function. class Array def iterate (code) self.each_with_index do |n, i| self[i] = code.call(n) end end end array = [1, 2, 3, 4] array. iterate (l ambda { |n| n ** 2 }) puts array.inspect # => [1, 4, 9, 16]
  • 7. Object oriented Similar to Java, PHP, Perl end end Point.new(@x*scalar, @y*scalar) def *(scalar) # To perform scalar multiplication Point.new(-@x, -@y) end def -@ # Define unary minus to negate x and y Point.new(@x + other.x, @y + other.y) end def +(other) # Define + to do vector addition @x,@y = x, y end Class Point attr_reader :x, :y # Define accessor methods
  • 9. Reflective Language TBD TBD: Java Reflection.
  • 10. Ruby on Rails Open source web application framework MIT license. Used with Agile development methodology Rail architecture A MVC model Scaffolding : Automatically creates a skeleton of a basic website. WEBrick. Mongrel: Web servers. Rake: A build system. Test-Driven ActiveRecord An object-relational mapping system for database access
  • 12. Rails architecture: 3-tier, N-tier? http://picasaweb.google.com/Dikiwinky/Ruby#5116531304417868130
  • 13. Rails architecture: MVC Q: Where is M, V and C?
  • 14. Ruby Agile Development Iterative development. Self organized. Cross-functional team. Leadership philosophy: No real leader. Frequent inspection and adaptation. Allow high-quality. Rapid delivery.
  • 15. Ruby Scaffolding Generate source as needed-> Create a database (cookbook) Configure /config/database.yml Generate source code: ruby script/generate scaffold Recipe title:string chef:string instructions:text
  • 16. exists app/models/ exists app/controllers/ exists app/helpers/ create app/views/recipes exists app/views/layouts/ exists test/functional/ exists test/unit/ exists public/stylesheets/ create app/views/recipes/index.html.erb create app/views/recipes/show.html.erb create app/views/recipes/new.html.erb create app/views/recipes/edit.html.erb create app/views/layouts/recipes.html.erb create public/stylesheets/scaffold.css create app/controllers/recipes_controller.rb create test/functional/recipes_controller_test.rb create app/helpers/recipes_helper.rb route map.resources :recipes dependency model exists app/models/ exists test/unit/ exists test/fixtures/ create app/models/recipe.rb create test/unit/recipe_test.rb create test/fixtures/recipes.yml create db/migrate create db/migrate/20080614192220_create_recipes.rb
  • 17. exists app/models/ exists app/controllers/ exists app/helpers/ create app/views/recipes exists app/views/layouts/ exists test/functional/ exists test/unit/ exists public/stylesheets/ create app/views/recipes/index.html.erb create app/views/recipes/show.html.erb create app/views/recipes/new.html.erb create app/views/recipes/edit.html.erb create app/views/layouts/recipes.html.erb create public/stylesheets/scaffold.css create app/controllers/recipes_controller.rb create test/functional/recipes_controller_test.rb create app/helpers/recipes_helper.rb route map.resources :recipes dependency model exists app/models/ exists test/unit/ exists test/fixtures/ create app/models/recipe.rb create test/unit/recipe_test.rb create test/fixtures/recipes.yml create db/migrate create db/migrate/20080614192220_create_recipes.rb
  • 18. Ruby, Rails Installation CentOS 5: yum install -y ruby yum install -y ruby-devel ruby-docs ruby-ri ruby-irb ruby-rdoc tar xzvf rubygems-1.3.1.tgz cd rubygems sudo ruby setup.rb sudo gem update sudo gem install rails Windows http://rubyonrails.org/download
  • 19. Gems installed on Server 123 [vuhung@vinicorp ~]$ sudo gem list *** LOCAL GEMS *** actionmailer (2.3.5, 2.2.2) actionpack (2.3.5, 2.2.2) activerecord (2.3.5, 2.2.2) activeresource (2.3.5, 2.2.2) activesupport (2.3.5, 2.2.2) eventmachine (0.12.10) fastthread (1.0.7) htmlentities (4.2.0) json (1.2.0) juggernaut (0.5.8) passenger (2.2.9) rack (1.0.1) rails (2.3.5, 2.2.2) rake (0.8.7
  • 20. Rake A software building tool (automatically). Written in Ruby. Configuration file: Rakefiles, ruby syntax. Common task can be done by ruby blocks (make cannot). Rake GNU make
  • 21. Test-Driven Development Test first Write test-cases first. Automatic test cases generation. Short development circle. Regression test. Automated unit test. “Test” folder generated by Rake.
  • 22. A short tutorial [vuhung@vinicorp ~]$ irb irb(main):001:0> puts "Hello Worlds" Hello Worlds => nil irb(main):002:0> 3+2 => 5 irb(main):003:0> 3*2 => 6 irb(main):004:0> 3**2 => 9 irb(main):005:0> Math.sqrt(9) => 3.0 irb(main):006:0> a = 3**2 => 9 irb(main):007:0> b = 4**2 => 16 irb(main):008:0> Math.sqrt(a+b) => 5.0 irb(main):009:0>
  • 23. Redmine Web based Project Management Application. Written in Ruby on Rails GPL v2 licensed (free software). Rake as build system. Gems WEBrick Plenty of plugins available. Stable since 2009/11 to date. Supports various DB back-end after Rails.
  • 24. Redmine Folder Structure (2) ls -1 /var/www/html/redmine/redmine-0.8.7 app config db doc extra files lang lib log public Rakefile script start_redmine.sh test tmp vendor
  • 25.  
  • 26. TODO http://www.railstutorial.org/book#top http://www.railstutorial.org/chapters/a-demo-app#top http://www.railstutorial.org/chapters/static-pages#top http://www.railstutorial.org/chapters/rails-flavored-ruby#top http://www.railstutorial.org/chapters/filling-in-the-layout#top http://www.railstutorial.org/chapters/modeling-and-viewing-users-one#top http://www.railstutorial.org/chapters/modeling-and-viewing-users-two#top http://www.railstutorial.org/chapters/sign-up#top http://www.railstutorial.org/chapters/sign-in-sign-out#top http://www.railstutorial.org/chapters/updating-showing-and-deleting-users#top
  • 27. TODO http://www-users.math.umd.edu/~dcarrera/ruby/0.3/chp_01/strings.html http://www-users.math.umd.edu/~dcarrera/ruby/0.3/chp_01/strings.html http://www-users.math.umd.edu/~dcarrera/ruby/0.3/chp_01/objects.html http://www-users.math.umd.edu/~dcarrera/ruby/0.3/chp_01/variables.html http://www-users.math.umd.edu/~dcarrera/ruby/0.3/chp_01/programs.html http://www-users.math.umd.edu/~dcarrera/ruby/0.3/chp_01/tips.html http://www-users.math.umd.edu/~dcarrera/ruby/0.3/chp_02/loops.html http://www-users.math.umd.edu/~dcarrera/ruby/0.3/chp_02/user_input.html http://www-users.math.umd.edu/~dcarrera/ruby/0.3/chp_02/conditionals.html http://www-users.math.umd.edu/~dcarrera/ruby/0.3/chp_02/tips.html http://www-users.math.umd.edu/~dcarrera/ruby/0.3/chp_03/arrays.html http://www-users.math.umd.edu/~dcarrera/ruby/0.3/chp_03/iterators.html http://www-users.math.umd.edu/~dcarrera/ruby/0.3/chp_03/hashes.html http://www-users.math.umd.edu/~dcarrera/ruby/0.3/chp_03/address.html http://www-users.math.umd.edu/~dcarrera/ruby/0.3/chp_03/address2.html http://www-users.math.umd.edu/~dcarrera/ruby/0.3/chp_03/sorting.html http://www-users.math.umd.edu/~dcarrera/ruby/0.3/chp_04/classes.html http://www-users.math.umd.edu/~dcarrera/ruby/0.3/chp_03/address2.html http://www-users.math.umd.edu/~dcarrera/ruby/0.3/chp_03/sorting.html http://www-users.math.umd.edu/~dcarrera/ruby/0.3/chp_04/functions.html http://www-users.math.umd.edu/~dcarrera/ruby/0.3/chp_04/classes.html http://www-users.math.umd.edu/~dcarrera/ruby/0.3/chp_04/classes2.html http://www-users.math.umd.edu/~dcarrera/ruby/0.3/chp_04/addressbook.html http://www-users.math.umd.edu/~dcarrera/ruby/0.3/chp_04/features.html
  • 28. References http://en.wikipedia.org/wiki/Rapid_application_development http://en.wikipedia.org/wiki/Agile_software_development http://en.wikipedia.org/wiki/Yukihiro_Matsumoto http://en.wikipedia.org/wiki/Ruby_%28programming_language%29#Examples http://en.wikipedia.org/wiki/Ruby_%28programming_language%29 http://en.wikipedia.org/wiki/Ruby_on_Rails http://www.google.com/webhp?hl=en#hl=en&source=hp&q=ruby+functional+programming&aq=f&aqi=&aql=&oq=&gs_rfai=&fp=a86c207b1c79523e http://stackoverflow.com/questions/159797/is-ruby-a-functional-language http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/330387 http://stackoverflow.com/questions/546968/when-you-say-ruby-is-reflective-does-this-mainly-refer-to-duck-typing http://www.tutorialspoint.com/ruby/ruby_object_oriented.htm http://www.rubyist.net/~slagell/ruby/oothinking.html http://www.techotopia.com/index.php/Ruby_Object_Oriented_Programming http://d.hatena.ne.jp/shunsuk/20090101/1230816826 http://www.slideshare.net/peter_marklund/ruby-on-rails-101-presentation-slides-for-a-five-day-introductory-course http://picasaweb.google.com/Dikiwinky/Ruby#5116531304417868130 http://articles.slicehost.com/2009/4/7/centos-ruby-on-rails http://www.railstutorial.org/book