introduction to web applications...ruby on rails framework written in ruby set of functionality to...
TRANSCRIPT
![Page 1: Introduction to Web Applications...Ruby on Rails Framework written in Ruby set of functionality to help write web applications – Connecting to the database (ActiveRecord) – Generating](https://reader034.vdocuments.mx/reader034/viewer/2022042806/5f740d652a8acc0b980eae3d/html5/thumbnails/1.jpg)
Introduction to Web Applications
Tobias Pfeiffer@PragTob
pragtob.wordpress.com
![Page 2: Introduction to Web Applications...Ruby on Rails Framework written in Ruby set of functionality to help write web applications – Connecting to the database (ActiveRecord) – Generating](https://reader034.vdocuments.mx/reader034/viewer/2022042806/5f740d652a8acc0b980eae3d/html5/thumbnails/2.jpg)
Today
![Page 3: Introduction to Web Applications...Ruby on Rails Framework written in Ruby set of functionality to help write web applications – Connecting to the database (ActiveRecord) – Generating](https://reader034.vdocuments.mx/reader034/viewer/2022042806/5f740d652a8acc0b980eae3d/html5/thumbnails/3.jpg)
![Page 4: Introduction to Web Applications...Ruby on Rails Framework written in Ruby set of functionality to help write web applications – Connecting to the database (ActiveRecord) – Generating](https://reader034.vdocuments.mx/reader034/viewer/2022042806/5f740d652a8acc0b980eae3d/html5/thumbnails/4.jpg)
What is a web application?
![Page 5: Introduction to Web Applications...Ruby on Rails Framework written in Ruby set of functionality to help write web applications – Connecting to the database (ActiveRecord) – Generating](https://reader034.vdocuments.mx/reader034/viewer/2022042806/5f740d652a8acc0b980eae3d/html5/thumbnails/5.jpg)
Not rocket science
![Page 7: Introduction to Web Applications...Ruby on Rails Framework written in Ruby set of functionality to help write web applications – Connecting to the database (ActiveRecord) – Generating](https://reader034.vdocuments.mx/reader034/viewer/2022042806/5f740d652a8acc0b980eae3d/html5/thumbnails/7.jpg)
Programming is fun!
![Page 8: Introduction to Web Applications...Ruby on Rails Framework written in Ruby set of functionality to help write web applications – Connecting to the database (ActiveRecord) – Generating](https://reader034.vdocuments.mx/reader034/viewer/2022042806/5f740d652a8acc0b980eae3d/html5/thumbnails/8.jpg)
What you are goingto build today
![Page 9: Introduction to Web Applications...Ruby on Rails Framework written in Ruby set of functionality to help write web applications – Connecting to the database (ActiveRecord) – Generating](https://reader034.vdocuments.mx/reader034/viewer/2022042806/5f740d652a8acc0b980eae3d/html5/thumbnails/9.jpg)
So what is a web application?
![Page 10: Introduction to Web Applications...Ruby on Rails Framework written in Ruby set of functionality to help write web applications – Connecting to the database (ActiveRecord) – Generating](https://reader034.vdocuments.mx/reader034/viewer/2022042806/5f740d652a8acc0b980eae3d/html5/thumbnails/10.jpg)
Presented in aweb browser
![Page 11: Introduction to Web Applications...Ruby on Rails Framework written in Ruby set of functionality to help write web applications – Connecting to the database (ActiveRecord) – Generating](https://reader034.vdocuments.mx/reader034/viewer/2022042806/5f740d652a8acc0b980eae3d/html5/thumbnails/11.jpg)
Runs on a server...
![Page 12: Introduction to Web Applications...Ruby on Rails Framework written in Ruby set of functionality to help write web applications – Connecting to the database (ActiveRecord) – Generating](https://reader034.vdocuments.mx/reader034/viewer/2022042806/5f740d652a8acc0b980eae3d/html5/thumbnails/12.jpg)
...or the cloud
![Page 13: Introduction to Web Applications...Ruby on Rails Framework written in Ruby set of functionality to help write web applications – Connecting to the database (ActiveRecord) – Generating](https://reader034.vdocuments.mx/reader034/viewer/2022042806/5f740d652a8acc0b980eae3d/html5/thumbnails/13.jpg)
is dynamic
![Page 14: Introduction to Web Applications...Ruby on Rails Framework written in Ruby set of functionality to help write web applications – Connecting to the database (ActiveRecord) – Generating](https://reader034.vdocuments.mx/reader034/viewer/2022042806/5f740d652a8acc0b980eae3d/html5/thumbnails/14.jpg)
A high level overview
![Page 15: Introduction to Web Applications...Ruby on Rails Framework written in Ruby set of functionality to help write web applications – Connecting to the database (ActiveRecord) – Generating](https://reader034.vdocuments.mx/reader034/viewer/2022042806/5f740d652a8acc0b980eae3d/html5/thumbnails/15.jpg)
High level overview
![Page 16: Introduction to Web Applications...Ruby on Rails Framework written in Ruby set of functionality to help write web applications – Connecting to the database (ActiveRecord) – Generating](https://reader034.vdocuments.mx/reader034/viewer/2022042806/5f740d652a8acc0b980eae3d/html5/thumbnails/16.jpg)
High level overview
![Page 17: Introduction to Web Applications...Ruby on Rails Framework written in Ruby set of functionality to help write web applications – Connecting to the database (ActiveRecord) – Generating](https://reader034.vdocuments.mx/reader034/viewer/2022042806/5f740d652a8acc0b980eae3d/html5/thumbnails/17.jpg)
High level overview
Request
![Page 18: Introduction to Web Applications...Ruby on Rails Framework written in Ruby set of functionality to help write web applications – Connecting to the database (ActiveRecord) – Generating](https://reader034.vdocuments.mx/reader034/viewer/2022042806/5f740d652a8acc0b980eae3d/html5/thumbnails/18.jpg)
High level overview
![Page 19: Introduction to Web Applications...Ruby on Rails Framework written in Ruby set of functionality to help write web applications – Connecting to the database (ActiveRecord) – Generating](https://reader034.vdocuments.mx/reader034/viewer/2022042806/5f740d652a8acc0b980eae3d/html5/thumbnails/19.jpg)
High level overview
Answer
![Page 20: Introduction to Web Applications...Ruby on Rails Framework written in Ruby set of functionality to help write web applications – Connecting to the database (ActiveRecord) – Generating](https://reader034.vdocuments.mx/reader034/viewer/2022042806/5f740d652a8acc0b980eae3d/html5/thumbnails/20.jpg)
High level overview
Answer
![Page 21: Introduction to Web Applications...Ruby on Rails Framework written in Ruby set of functionality to help write web applications – Connecting to the database (ActiveRecord) – Generating](https://reader034.vdocuments.mx/reader034/viewer/2022042806/5f740d652a8acc0b980eae3d/html5/thumbnails/21.jpg)
High level overview
![Page 22: Introduction to Web Applications...Ruby on Rails Framework written in Ruby set of functionality to help write web applications – Connecting to the database (ActiveRecord) – Generating](https://reader034.vdocuments.mx/reader034/viewer/2022042806/5f740d652a8acc0b980eae3d/html5/thumbnails/22.jpg)
What parts does a web application consist of?
![Page 23: Introduction to Web Applications...Ruby on Rails Framework written in Ruby set of functionality to help write web applications – Connecting to the database (ActiveRecord) – Generating](https://reader034.vdocuments.mx/reader034/viewer/2022042806/5f740d652a8acc0b980eae3d/html5/thumbnails/23.jpg)
Web Application
![Page 24: Introduction to Web Applications...Ruby on Rails Framework written in Ruby set of functionality to help write web applications – Connecting to the database (ActiveRecord) – Generating](https://reader034.vdocuments.mx/reader034/viewer/2022042806/5f740d652a8acc0b980eae3d/html5/thumbnails/24.jpg)
Front End
Back End
![Page 25: Introduction to Web Applications...Ruby on Rails Framework written in Ruby set of functionality to help write web applications – Connecting to the database (ActiveRecord) – Generating](https://reader034.vdocuments.mx/reader034/viewer/2022042806/5f740d652a8acc0b980eae3d/html5/thumbnails/25.jpg)
Front End
Back End
![Page 26: Introduction to Web Applications...Ruby on Rails Framework written in Ruby set of functionality to help write web applications – Connecting to the database (ActiveRecord) – Generating](https://reader034.vdocuments.mx/reader034/viewer/2022042806/5f740d652a8acc0b980eae3d/html5/thumbnails/26.jpg)
CSS
HTML
JavaScript
![Page 27: Introduction to Web Applications...Ruby on Rails Framework written in Ruby set of functionality to help write web applications – Connecting to the database (ActiveRecord) – Generating](https://reader034.vdocuments.mx/reader034/viewer/2022042806/5f740d652a8acc0b980eae3d/html5/thumbnails/27.jpg)
Structure and content
![Page 28: Introduction to Web Applications...Ruby on Rails Framework written in Ruby set of functionality to help write web applications – Connecting to the database (ActiveRecord) – Generating](https://reader034.vdocuments.mx/reader034/viewer/2022042806/5f740d652a8acc0b980eae3d/html5/thumbnails/28.jpg)
CSS
HTML
JavaScript
![Page 29: Introduction to Web Applications...Ruby on Rails Framework written in Ruby set of functionality to help write web applications – Connecting to the database (ActiveRecord) – Generating](https://reader034.vdocuments.mx/reader034/viewer/2022042806/5f740d652a8acc0b980eae3d/html5/thumbnails/29.jpg)
Styling to transform...
![Page 30: Introduction to Web Applications...Ruby on Rails Framework written in Ruby set of functionality to help write web applications – Connecting to the database (ActiveRecord) – Generating](https://reader034.vdocuments.mx/reader034/viewer/2022042806/5f740d652a8acc0b980eae3d/html5/thumbnails/30.jpg)
...this...
![Page 31: Introduction to Web Applications...Ruby on Rails Framework written in Ruby set of functionality to help write web applications – Connecting to the database (ActiveRecord) – Generating](https://reader034.vdocuments.mx/reader034/viewer/2022042806/5f740d652a8acc0b980eae3d/html5/thumbnails/31.jpg)
...into this.
![Page 32: Introduction to Web Applications...Ruby on Rails Framework written in Ruby set of functionality to help write web applications – Connecting to the database (ActiveRecord) – Generating](https://reader034.vdocuments.mx/reader034/viewer/2022042806/5f740d652a8acc0b980eae3d/html5/thumbnails/32.jpg)
CSS
HTML
JavaScript
![Page 33: Introduction to Web Applications...Ruby on Rails Framework written in Ruby set of functionality to help write web applications – Connecting to the database (ActiveRecord) – Generating](https://reader034.vdocuments.mx/reader034/viewer/2022042806/5f740d652a8acc0b980eae3d/html5/thumbnails/33.jpg)
Back End
CSS
HTML
JavaScript
![Page 34: Introduction to Web Applications...Ruby on Rails Framework written in Ruby set of functionality to help write web applications – Connecting to the database (ActiveRecord) – Generating](https://reader034.vdocuments.mx/reader034/viewer/2022042806/5f740d652a8acc0b980eae3d/html5/thumbnails/34.jpg)
Back End
CSS
HTML
JavaScript
![Page 35: Introduction to Web Applications...Ruby on Rails Framework written in Ruby set of functionality to help write web applications – Connecting to the database (ActiveRecord) – Generating](https://reader034.vdocuments.mx/reader034/viewer/2022042806/5f740d652a8acc0b980eae3d/html5/thumbnails/35.jpg)
Logic
Infrastructure
![Page 36: Introduction to Web Applications...Ruby on Rails Framework written in Ruby set of functionality to help write web applications – Connecting to the database (ActiveRecord) – Generating](https://reader034.vdocuments.mx/reader034/viewer/2022042806/5f740d652a8acc0b980eae3d/html5/thumbnails/36.jpg)
Logic
Infrastructure
![Page 37: Introduction to Web Applications...Ruby on Rails Framework written in Ruby set of functionality to help write web applications – Connecting to the database (ActiveRecord) – Generating](https://reader034.vdocuments.mx/reader034/viewer/2022042806/5f740d652a8acc0b980eae3d/html5/thumbnails/37.jpg)
Logic
● Behaviour● Implements the business logic● Ties all the parts together● Generates content
![Page 38: Introduction to Web Applications...Ruby on Rails Framework written in Ruby set of functionality to help write web applications – Connecting to the database (ActiveRecord) – Generating](https://reader034.vdocuments.mx/reader034/viewer/2022042806/5f740d652a8acc0b980eae3d/html5/thumbnails/38.jpg)
Ruby on Rails
![Page 39: Introduction to Web Applications...Ruby on Rails Framework written in Ruby set of functionality to help write web applications – Connecting to the database (ActiveRecord) – Generating](https://reader034.vdocuments.mx/reader034/viewer/2022042806/5f740d652a8acc0b980eae3d/html5/thumbnails/39.jpg)
Logic
Infrastructure
![Page 40: Introduction to Web Applications...Ruby on Rails Framework written in Ruby set of functionality to help write web applications – Connecting to the database (ActiveRecord) – Generating](https://reader034.vdocuments.mx/reader034/viewer/2022042806/5f740d652a8acc0b980eae3d/html5/thumbnails/40.jpg)
Web Server
![Page 41: Introduction to Web Applications...Ruby on Rails Framework written in Ruby set of functionality to help write web applications – Connecting to the database (ActiveRecord) – Generating](https://reader034.vdocuments.mx/reader034/viewer/2022042806/5f740d652a8acc0b980eae3d/html5/thumbnails/41.jpg)
Logic
Infrastructure
![Page 42: Introduction to Web Applications...Ruby on Rails Framework written in Ruby set of functionality to help write web applications – Connecting to the database (ActiveRecord) – Generating](https://reader034.vdocuments.mx/reader034/viewer/2022042806/5f740d652a8acc0b980eae3d/html5/thumbnails/42.jpg)
Storing all yourdata...
![Page 43: Introduction to Web Applications...Ruby on Rails Framework written in Ruby set of functionality to help write web applications – Connecting to the database (ActiveRecord) – Generating](https://reader034.vdocuments.mx/reader034/viewer/2022042806/5f740d652a8acc0b980eae3d/html5/thumbnails/43.jpg)
...in giant tables
![Page 44: Introduction to Web Applications...Ruby on Rails Framework written in Ruby set of functionality to help write web applications – Connecting to the database (ActiveRecord) – Generating](https://reader034.vdocuments.mx/reader034/viewer/2022042806/5f740d652a8acc0b980eae3d/html5/thumbnails/44.jpg)
Recap
![Page 45: Introduction to Web Applications...Ruby on Rails Framework written in Ruby set of functionality to help write web applications – Connecting to the database (ActiveRecord) – Generating](https://reader034.vdocuments.mx/reader034/viewer/2022042806/5f740d652a8acc0b980eae3d/html5/thumbnails/45.jpg)
Logic
Storage
Infrastructure
CSS
HTML
JavaScript
Web Application Landscape
![Page 46: Introduction to Web Applications...Ruby on Rails Framework written in Ruby set of functionality to help write web applications – Connecting to the database (ActiveRecord) – Generating](https://reader034.vdocuments.mx/reader034/viewer/2022042806/5f740d652a8acc0b980eae3d/html5/thumbnails/46.jpg)
Logic
Storage
Infrastructure
CSS
HTML
JavaScript
Web Application Landscape
Bootstrap
XML DOM
jQuery
Ruby on Rails
Sqlite
Apache
WEBrick
MongoD
B
Thin
RubyPHP
Python
Django
![Page 47: Introduction to Web Applications...Ruby on Rails Framework written in Ruby set of functionality to help write web applications – Connecting to the database (ActiveRecord) – Generating](https://reader034.vdocuments.mx/reader034/viewer/2022042806/5f740d652a8acc0b980eae3d/html5/thumbnails/47.jpg)
But what is Ruby on Rails?
![Page 48: Introduction to Web Applications...Ruby on Rails Framework written in Ruby set of functionality to help write web applications – Connecting to the database (ActiveRecord) – Generating](https://reader034.vdocuments.mx/reader034/viewer/2022042806/5f740d652a8acc0b980eae3d/html5/thumbnails/48.jpg)
A web application framework written in Ruby
![Page 49: Introduction to Web Applications...Ruby on Rails Framework written in Ruby set of functionality to help write web applications – Connecting to the database (ActiveRecord) – Generating](https://reader034.vdocuments.mx/reader034/viewer/2022042806/5f740d652a8acc0b980eae3d/html5/thumbnails/49.jpg)
● A general purpose programming language
● Principle of least surprise● Invented by Yukihiro Matsumoto
![Page 50: Introduction to Web Applications...Ruby on Rails Framework written in Ruby set of functionality to help write web applications – Connecting to the database (ActiveRecord) – Generating](https://reader034.vdocuments.mx/reader034/viewer/2022042806/5f740d652a8acc0b980eae3d/html5/thumbnails/50.jpg)
"I hope to see Ruby help every programmer in the world to be productive, and to enjoy programming, and to be happy. That is the primary purpose of Ruby language."Yukihiro Matsumoto
![Page 51: Introduction to Web Applications...Ruby on Rails Framework written in Ruby set of functionality to help write web applications – Connecting to the database (ActiveRecord) – Generating](https://reader034.vdocuments.mx/reader034/viewer/2022042806/5f740d652a8acc0b980eae3d/html5/thumbnails/51.jpg)
Ruby on Rails
● Framework written in Ruby● set of functionality to help write web
applications– Connecting to the database (ActiveRecord)– Generating HTML (ERB)– Pays attention to security– … and so much more!
● Model View Controller● You write in Ruby
![Page 52: Introduction to Web Applications...Ruby on Rails Framework written in Ruby set of functionality to help write web applications – Connecting to the database (ActiveRecord) – Generating](https://reader034.vdocuments.mx/reader034/viewer/2022042806/5f740d652a8acc0b980eae3d/html5/thumbnails/52.jpg)
Let's get into some Ruby
![Page 53: Introduction to Web Applications...Ruby on Rails Framework written in Ruby set of functionality to help write web applications – Connecting to the database (ActiveRecord) – Generating](https://reader034.vdocuments.mx/reader034/viewer/2022042806/5f740d652a8acc0b980eae3d/html5/thumbnails/53.jpg)
But before that...
![Page 54: Introduction to Web Applications...Ruby on Rails Framework written in Ruby set of functionality to help write web applications – Connecting to the database (ActiveRecord) – Generating](https://reader034.vdocuments.mx/reader034/viewer/2022042806/5f740d652a8acc0b980eae3d/html5/thumbnails/54.jpg)
Cookies & Questions
![Page 55: Introduction to Web Applications...Ruby on Rails Framework written in Ruby set of functionality to help write web applications – Connecting to the database (ActiveRecord) – Generating](https://reader034.vdocuments.mx/reader034/viewer/2022042806/5f740d652a8acc0b980eae3d/html5/thumbnails/55.jpg)
Open a terminal/console
![Page 56: Introduction to Web Applications...Ruby on Rails Framework written in Ruby set of functionality to help write web applications – Connecting to the database (ActiveRecord) – Generating](https://reader034.vdocuments.mx/reader034/viewer/2022042806/5f740d652a8acc0b980eae3d/html5/thumbnails/56.jpg)
irb
![Page 57: Introduction to Web Applications...Ruby on Rails Framework written in Ruby set of functionality to help write web applications – Connecting to the database (ActiveRecord) – Generating](https://reader034.vdocuments.mx/reader034/viewer/2022042806/5f740d652a8acc0b980eae3d/html5/thumbnails/57.jpg)
tobi@speedy:~$ irb1.9.3p194 :001 >
![Page 58: Introduction to Web Applications...Ruby on Rails Framework written in Ruby set of functionality to help write web applications – Connecting to the database (ActiveRecord) – Generating](https://reader034.vdocuments.mx/reader034/viewer/2022042806/5f740d652a8acc0b980eae3d/html5/thumbnails/58.jpg)
irb – interactive ruby
● talking to ruby● You tell ruby something● Ruby responds with what it understood● Coaches are going to help you!
![Page 59: Introduction to Web Applications...Ruby on Rails Framework written in Ruby set of functionality to help write web applications – Connecting to the database (ActiveRecord) – Generating](https://reader034.vdocuments.mx/reader034/viewer/2022042806/5f740d652a8acc0b980eae3d/html5/thumbnails/59.jpg)
1.9.3p194 :001 > 5 => 5
![Page 60: Introduction to Web Applications...Ruby on Rails Framework written in Ruby set of functionality to help write web applications – Connecting to the database (ActiveRecord) – Generating](https://reader034.vdocuments.mx/reader034/viewer/2022042806/5f740d652a8acc0b980eae3d/html5/thumbnails/60.jpg)
1.9.3p194 :002 > 5 + 3 => 8
![Page 61: Introduction to Web Applications...Ruby on Rails Framework written in Ruby set of functionality to help write web applications – Connecting to the database (ActiveRecord) – Generating](https://reader034.vdocuments.mx/reader034/viewer/2022042806/5f740d652a8acc0b980eae3d/html5/thumbnails/61.jpg)
1.9.3p194 :003 > 8 * 7 => 56
![Page 62: Introduction to Web Applications...Ruby on Rails Framework written in Ruby set of functionality to help write web applications – Connecting to the database (ActiveRecord) – Generating](https://reader034.vdocuments.mx/reader034/viewer/2022042806/5f740d652a8acc0b980eae3d/html5/thumbnails/62.jpg)
1.9.3p194 :004 > "Tobias Pfeiffer" => "Tobias Pfeiffer"
![Page 63: Introduction to Web Applications...Ruby on Rails Framework written in Ruby set of functionality to help write web applications – Connecting to the database (ActiveRecord) – Generating](https://reader034.vdocuments.mx/reader034/viewer/2022042806/5f740d652a8acc0b980eae3d/html5/thumbnails/63.jpg)
1.9.3p194 :005 > name = "Tobi" => "Tobi"
![Page 64: Introduction to Web Applications...Ruby on Rails Framework written in Ruby set of functionality to help write web applications – Connecting to the database (ActiveRecord) – Generating](https://reader034.vdocuments.mx/reader034/viewer/2022042806/5f740d652a8acc0b980eae3d/html5/thumbnails/64.jpg)
1.9.3p194 :006 > name => "Tobi"
![Page 65: Introduction to Web Applications...Ruby on Rails Framework written in Ruby set of functionality to help write web applications – Connecting to the database (ActiveRecord) – Generating](https://reader034.vdocuments.mx/reader034/viewer/2022042806/5f740d652a8acc0b980eae3d/html5/thumbnails/65.jpg)
1.9.3p194 :007 > result = 8 * 7 => 56
![Page 66: Introduction to Web Applications...Ruby on Rails Framework written in Ruby set of functionality to help write web applications – Connecting to the database (ActiveRecord) – Generating](https://reader034.vdocuments.mx/reader034/viewer/2022042806/5f740d652a8acc0b980eae3d/html5/thumbnails/66.jpg)
1.9.3p194 :008 > result * 10 => 560
![Page 67: Introduction to Web Applications...Ruby on Rails Framework written in Ruby set of functionality to help write web applications – Connecting to the database (ActiveRecord) – Generating](https://reader034.vdocuments.mx/reader034/viewer/2022042806/5f740d652a8acc0b980eae3d/html5/thumbnails/67.jpg)
1.9.3p194 :009 > name + " likes Sweden" => "Tobi likes Sweden"
![Page 68: Introduction to Web Applications...Ruby on Rails Framework written in Ruby set of functionality to help write web applications – Connecting to the database (ActiveRecord) – Generating](https://reader034.vdocuments.mx/reader034/viewer/2022042806/5f740d652a8acc0b980eae3d/html5/thumbnails/68.jpg)
1.9.3p194 :010 > puts "Hello World!"Hello World! => nil
![Page 69: Introduction to Web Applications...Ruby on Rails Framework written in Ruby set of functionality to help write web applications – Connecting to the database (ActiveRecord) – Generating](https://reader034.vdocuments.mx/reader034/viewer/2022042806/5f740d652a8acc0b980eae3d/html5/thumbnails/69.jpg)
1.9.3p194 :011 > fruits = ["apple", "keewee", "orange"] => ["apple", "keewee", "orange"]
![Page 70: Introduction to Web Applications...Ruby on Rails Framework written in Ruby set of functionality to help write web applications – Connecting to the database (ActiveRecord) – Generating](https://reader034.vdocuments.mx/reader034/viewer/2022042806/5f740d652a8acc0b980eae3d/html5/thumbnails/70.jpg)
1.9.3p194 :013 > fruits.each do |fruit| puts fruit endapplekeeweeorange => ["apple", "keewee", "orange"]
![Page 71: Introduction to Web Applications...Ruby on Rails Framework written in Ruby set of functionality to help write web applications – Connecting to the database (ActiveRecord) – Generating](https://reader034.vdocuments.mx/reader034/viewer/2022042806/5f740d652a8acc0b980eae3d/html5/thumbnails/71.jpg)
1.9.3p194 :014 > fruits[0] => "apple"
![Page 72: Introduction to Web Applications...Ruby on Rails Framework written in Ruby set of functionality to help write web applications – Connecting to the database (ActiveRecord) – Generating](https://reader034.vdocuments.mx/reader034/viewer/2022042806/5f740d652a8acc0b980eae3d/html5/thumbnails/72.jpg)
1.9.3p194 :015 > symbol = :wuh => :wuh 1.9.3p194 :016 > symbol => :wuh
![Page 73: Introduction to Web Applications...Ruby on Rails Framework written in Ruby set of functionality to help write web applications – Connecting to the database (ActiveRecord) – Generating](https://reader034.vdocuments.mx/reader034/viewer/2022042806/5f740d652a8acc0b980eae3d/html5/thumbnails/73.jpg)
1.9.3p194 :017 > dictionary = {:hi => "Hej", :good => "bra", :cookie => "kaka"} => {:hi=>"Hej", :good=>"bra", :cookie=>"kaka"} 1.9.3p194 :018 > dictionary[:hi] => "Hej" 1.9.3p194 :019 > dictionary[:cookie] => "kaka"
![Page 74: Introduction to Web Applications...Ruby on Rails Framework written in Ruby set of functionality to help write web applications – Connecting to the database (ActiveRecord) – Generating](https://reader034.vdocuments.mx/reader034/viewer/2022042806/5f740d652a8acc0b980eae3d/html5/thumbnails/74.jpg)
1.9.3p194 :020 > def hello1.9.3p194 :021?> puts "Hello there!"1.9.3p194 :022?> end => nil
![Page 75: Introduction to Web Applications...Ruby on Rails Framework written in Ruby set of functionality to help write web applications – Connecting to the database (ActiveRecord) – Generating](https://reader034.vdocuments.mx/reader034/viewer/2022042806/5f740d652a8acc0b980eae3d/html5/thumbnails/75.jpg)
1.9.3p194 :026 > helloHello there! => nil
![Page 76: Introduction to Web Applications...Ruby on Rails Framework written in Ruby set of functionality to help write web applications – Connecting to the database (ActiveRecord) – Generating](https://reader034.vdocuments.mx/reader034/viewer/2022042806/5f740d652a8acc0b980eae3d/html5/thumbnails/76.jpg)
1.9.3p194 :023 > def greeter(person)1.9.3p194 :024?> puts "Hello " + person1.9.3p194 :025?> end => nil
![Page 77: Introduction to Web Applications...Ruby on Rails Framework written in Ruby set of functionality to help write web applications – Connecting to the database (ActiveRecord) – Generating](https://reader034.vdocuments.mx/reader034/viewer/2022042806/5f740d652a8acc0b980eae3d/html5/thumbnails/77.jpg)
1.9.3p194 :027 > greeter("Fanny")Hello Fanny => nil
![Page 78: Introduction to Web Applications...Ruby on Rails Framework written in Ruby set of functionality to help write web applications – Connecting to the database (ActiveRecord) – Generating](https://reader034.vdocuments.mx/reader034/viewer/2022042806/5f740d652a8acc0b980eae3d/html5/thumbnails/78.jpg)
1.9.3p194 :028 > greeterArgumentError: wrong number of arguments (0 for 1)
from (irb):23:in `greeter'from (irb):28from /home/tobi/.rvm/rubies/ruby-1.9.3-
p194/bin/irb:16:in `<main>'
![Page 79: Introduction to Web Applications...Ruby on Rails Framework written in Ruby set of functionality to help write web applications – Connecting to the database (ActiveRecord) – Generating](https://reader034.vdocuments.mx/reader034/viewer/2022042806/5f740d652a8acc0b980eae3d/html5/thumbnails/79.jpg)
1.9.3p194 :029 > class Person1.9.3p194 :030?> attr_accessor :name, :age1.9.3p194 :031?> end => nil 1.9.3p194 :032 > tobi = Person.new => #<Person:0x0000000205f080>
![Page 80: Introduction to Web Applications...Ruby on Rails Framework written in Ruby set of functionality to help write web applications – Connecting to the database (ActiveRecord) – Generating](https://reader034.vdocuments.mx/reader034/viewer/2022042806/5f740d652a8acc0b980eae3d/html5/thumbnails/80.jpg)
1.9.3p194 :033 > tobi.name => nil 1.9.3p194 :034 > tobi.name = "Tobi" => "Tobi" 1.9.3p194 :035 > tobi.age = 23 => 23 1.9.3p194 :036 > tobi.name => "Tobi" 1.9.3p194 :037 > tobi.age => 23
![Page 81: Introduction to Web Applications...Ruby on Rails Framework written in Ruby set of functionality to help write web applications – Connecting to the database (ActiveRecord) – Generating](https://reader034.vdocuments.mx/reader034/viewer/2022042806/5f740d652a8acc0b980eae3d/html5/thumbnails/81.jpg)
1.9.3p194 :038 > tobi.age * 365 => 8395 1.9.3p194 :039 > puts "This was a talk by " + tobi.name + " - thank you!"This was a talk by Tobi - thank you! => nil
![Page 82: Introduction to Web Applications...Ruby on Rails Framework written in Ruby set of functionality to help write web applications – Connecting to the database (ActiveRecord) – Generating](https://reader034.vdocuments.mx/reader034/viewer/2022042806/5f740d652a8acc0b980eae3d/html5/thumbnails/82.jpg)
Thank you and enjoy coding!
Tobias Pfeiffer@PragTob
pragtob.wordpress.comlisten to me talking about learning Ruby (German)
![Page 83: Introduction to Web Applications...Ruby on Rails Framework written in Ruby set of functionality to help write web applications – Connecting to the database (ActiveRecord) – Generating](https://reader034.vdocuments.mx/reader034/viewer/2022042806/5f740d652a8acc0b980eae3d/html5/thumbnails/83.jpg)
Photo credit● http://www.flickr.com/photos/captainkimo/5918836159/
● http://www.flickr.com/photos/weppos/7486411688/
● http://www.flickr.com/photos/railsgirlsberlin/7882839698/in/photostream
● http://www.flickr.com/photos/nirak/644336486/