Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Ruby on Rails SS09 04

670 views

Published on

Published in: Technology
  • DOWNLOAD THIS BOOKS INTO AVAILABLE FORMAT (Unlimited) ......................................................................................................................... ......................................................................................................................... Download Full PDF EBOOK here { https://soo.gd/qURD } ......................................................................................................................... Download Full EPUB Ebook here { https://soo.gd/qURD } ......................................................................................................................... Download Full doc Ebook here { https://soo.gd/qURD } ......................................................................................................................... Download PDF EBOOK here { https://soo.gd/qURD } ......................................................................................................................... Download EPUB Ebook here { https://soo.gd/qURD } ......................................................................................................................... Download doc Ebook here { https://soo.gd/qURD } ......................................................................................................................... ......................................................................................................................... ................................................................................................................................... eBook is an electronic version of a traditional print book THIS can be read by using a personal computer or by using an eBook reader. (An eBook reader can be a software application for use on a computer such as Microsoft's free Reader application, or a book-sized computer THIS is used solely as a reading device such as Nuvomedia's Rocket eBook.) Users can purchase an eBook on diskette or CD, but the most popular method of getting an eBook is to purchase a downloadable file of the eBook (or other reading material) from a Web site (such as Barnes and Noble) to be read from the user's computer or reading device. Generally, an eBook can be downloaded in five minutes or less ......................................................................................................................... .............. Browse by Genre Available eBooks .............................................................................................................................. Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, ......................................................................................................................... ......................................................................................................................... .....BEST SELLER FOR EBOOK RECOMMEND............................................................. ......................................................................................................................... Blowout: Corrupted Democracy, Rogue State Russia, and the Richest, Most Destructive Industry on Earth,-- The Ride of a Lifetime: Lessons Learned from 15 Years as CEO of the Walt Disney Company,-- Call Sign Chaos: Learning to Lead,-- StrengthsFinder 2.0,-- Stillness Is the Key,-- She Said: Breaking the Sexual Harassment Story THIS Helped Ignite a Movement,-- Atomic Habits: An Easy & Proven Way to Build Good Habits & Break Bad Ones,-- Everything Is Figureoutable,-- What It Takes: Lessons in the Pursuit of Excellence,-- Rich Dad Poor Dad: What the Rich Teach Their Kids About Money THIS the Poor and Middle Class Do Not!,-- The Total Money Makeover: Classic Edition: A Proven Plan for Financial Fitness,-- Shut Up and Listen!: Hard Business Truths THIS Will Help You Succeed, ......................................................................................................................... .........................................................................................................................
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • DOWNLOAD THIS BOOKS INTO AVAILABLE FORMAT (2019 Update) ......................................................................................................................... ......................................................................................................................... Download Full PDF EBOOK here { https://soo.gd/irt2 } ......................................................................................................................... Download Full EPUB Ebook here { https://soo.gd/irt2 } ......................................................................................................................... Download Full doc Ebook here { https://soo.gd/irt2 } ......................................................................................................................... Download PDF EBOOK here { https://soo.gd/irt2 } ......................................................................................................................... Download EPUB Ebook here { https://soo.gd/irt2 } ......................................................................................................................... Download doc Ebook here { https://soo.gd/irt2 } ......................................................................................................................... ......................................................................................................................... ................................................................................................................................... eBook is an electronic version of a traditional print book THIS can be read by using a personal computer or by using an eBook reader. (An eBook reader can be a software application for use on a computer such as Microsoft's free Reader application, or a book-sized computer THIS is used solely as a reading device such as Nuvomedia's Rocket eBook.) Users can purchase an eBook on diskette or CD, but the most popular method of getting an eBook is to purchase a downloadable file of the eBook (or other reading material) from a Web site (such as Barnes and Noble) to be read from the user's computer or reading device. Generally, an eBook can be downloaded in five minutes or less ......................................................................................................................... .............. Browse by Genre Available eBooks .............................................................................................................................. Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, ......................................................................................................................... ......................................................................................................................... .....BEST SELLER FOR EBOOK RECOMMEND............................................................. ......................................................................................................................... Blowout: Corrupted Democracy, Rogue State Russia, and the Richest, Most Destructive Industry on Earth,-- The Ride of a Lifetime: Lessons Learned from 15 Years as CEO of the Walt Disney Company,-- Call Sign Chaos: Learning to Lead,-- StrengthsFinder 2.0,-- Stillness Is the Key,-- She Said: Breaking the Sexual Harassment Story THIS Helped Ignite a Movement,-- Atomic Habits: An Easy & Proven Way to Build Good Habits & Break Bad Ones,-- Everything Is Figureoutable,-- What It Takes: Lessons in the Pursuit of Excellence,-- Rich Dad Poor Dad: What the Rich Teach Their Kids About Money THIS the Poor and Middle Class Do Not!,-- The Total Money Makeover: Classic Edition: A Proven Plan for Financial Fitness,-- Shut Up and Listen!: Hard Business Truths THIS Will Help You Succeed, ......................................................................................................................... .........................................................................................................................
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • DOWNLOAD THIS BOOKS INTO AVAILABLE FORMAT (2019 Update) ......................................................................................................................... ......................................................................................................................... Download Full PDF EBOOK here { https://soo.gd/irt2 } ......................................................................................................................... Download Full EPUB Ebook here { https://soo.gd/irt2 } ......................................................................................................................... Download Full doc Ebook here { https://soo.gd/irt2 } ......................................................................................................................... Download PDF EBOOK here { https://soo.gd/irt2 } ......................................................................................................................... Download EPUB Ebook here { https://soo.gd/irt2 } ......................................................................................................................... Download doc Ebook here { https://soo.gd/irt2 } ......................................................................................................................... ......................................................................................................................... ................................................................................................................................... eBook is an electronic version of a traditional print book THIS can be read by using a personal computer or by using an eBook reader. (An eBook reader can be a software application for use on a computer such as Microsoft's free Reader application, or a book-sized computer THIS is used solely as a reading device such as Nuvomedia's Rocket eBook.) Users can purchase an eBook on diskette or CD, but the most popular method of getting an eBook is to purchase a downloadable file of the eBook (or other reading material) from a Web site (such as Barnes and Noble) to be read from the user's computer or reading device. Generally, an eBook can be downloaded in five minutes or less ......................................................................................................................... .............. Browse by Genre Available eBooks .............................................................................................................................. Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, ......................................................................................................................... ......................................................................................................................... .....BEST SELLER FOR EBOOK RECOMMEND............................................................. ......................................................................................................................... Blowout: Corrupted Democracy, Rogue State Russia, and the Richest, Most Destructive Industry on Earth,-- The Ride of a Lifetime: Lessons Learned from 15 Years as CEO of the Walt Disney Company,-- Call Sign Chaos: Learning to Lead,-- StrengthsFinder 2.0,-- Stillness Is the Key,-- She Said: Breaking the Sexual Harassment Story THIS Helped Ignite a Movement,-- Atomic Habits: An Easy & Proven Way to Build Good Habits & Break Bad Ones,-- Everything Is Figureoutable,-- What It Takes: Lessons in the Pursuit of Excellence,-- Rich Dad Poor Dad: What the Rich Teach Their Kids About Money THIS the Poor and Middle Class Do Not!,-- The Total Money Makeover: Classic Edition: A Proven Plan for Financial Fitness,-- Shut Up and Listen!: Hard Business Truths THIS Will Help You Succeed, ......................................................................................................................... .........................................................................................................................
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • DOWNLOAD THIS BOOKS INTO AVAILABLE FORMAT (Unlimited) ......................................................................................................................... ......................................................................................................................... Download Full PDF EBOOK here { https://soo.gd/qURD } ......................................................................................................................... Download Full EPUB Ebook here { https://soo.gd/qURD } ......................................................................................................................... Download Full doc Ebook here { https://soo.gd/qURD } ......................................................................................................................... Download PDF EBOOK here { https://soo.gd/qURD } ......................................................................................................................... Download EPUB Ebook here { https://soo.gd/qURD } ......................................................................................................................... Download doc Ebook here { https://soo.gd/qURD } ......................................................................................................................... ......................................................................................................................... ................................................................................................................................... eBook is an electronic version of a traditional print book THIS can be read by using a personal computer or by using an eBook reader. (An eBook reader can be a software application for use on a computer such as Microsoft's free Reader application, or a book-sized computer THIS is used solely as a reading device such as Nuvomedia's Rocket eBook.) Users can purchase an eBook on diskette or CD, but the most popular method of getting an eBook is to purchase a downloadable file of the eBook (or other reading material) from a Web site (such as Barnes and Noble) to be read from the user's computer or reading device. Generally, an eBook can be downloaded in five minutes or less ......................................................................................................................... .............. Browse by Genre Available eBooks .............................................................................................................................. Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, ......................................................................................................................... ......................................................................................................................... .....BEST SELLER FOR EBOOK RECOMMEND............................................................. ......................................................................................................................... Blowout: Corrupted Democracy, Rogue State Russia, and the Richest, Most Destructive Industry on Earth,-- The Ride of a Lifetime: Lessons Learned from 15 Years as CEO of the Walt Disney Company,-- Call Sign Chaos: Learning to Lead,-- StrengthsFinder 2.0,-- Stillness Is the Key,-- She Said: Breaking the Sexual Harassment Story THIS Helped Ignite a Movement,-- Atomic Habits: An Easy & Proven Way to Build Good Habits & Break Bad Ones,-- Everything Is Figureoutable,-- What It Takes: Lessons in the Pursuit of Excellence,-- Rich Dad Poor Dad: What the Rich Teach Their Kids About Money THIS the Poor and Middle Class Do Not!,-- The Total Money Makeover: Classic Edition: A Proven Plan for Financial Fitness,-- Shut Up and Listen!: Hard Business Truths THIS Will Help You Succeed, ......................................................................................................................... .........................................................................................................................
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • DOWNLOAD THAT BOOKS INTO AVAILABLE FORMAT (2019 Update) ......................................................................................................................... ......................................................................................................................... Download Full PDF EBOOK here { http://shorturl.at/mzUV6 } ......................................................................................................................... Download Full EPUB Ebook here { http://shorturl.at/mzUV6 } ......................................................................................................................... Download Full doc Ebook here { http://shorturl.at/mzUV6 } ......................................................................................................................... Download PDF EBOOK here { http://shorturl.at/mzUV6 } ......................................................................................................................... Download EPUB Ebook here { http://shorturl.at/mzUV6 } ......................................................................................................................... Download doc Ebook here { http://shorturl.at/mzUV6 } ......................................................................................................................... ......................................................................................................................... ................................................................................................................................... eBook is an electronic version of a traditional print book that can be read by using a personal computer or by using an eBook reader. (An eBook reader can be a software application for use on a computer such as Microsoft's free Reader application, or a book-sized computer that is used solely as a reading device such as Nuvomedia's Rocket eBook.) Users can purchase an eBook on diskette or CD, but the most popular method of getting an eBook is to purchase a downloadable file of the eBook (or other reading material) from a Web site (such as Barnes and Noble) to be read from the user's computer or reading device. Generally, an eBook can be downloaded in five minutes or less ......................................................................................................................... .............. Browse by Genre Available eBooks .............................................................................................................................. Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, ......................................................................................................................... ......................................................................................................................... .....BEST SELLER FOR EBOOK RECOMMEND............................................................. ......................................................................................................................... Blowout: Corrupted Democracy, Rogue State Russia, and the Richest, Most Destructive Industry on Earth,-- The Ride of a Lifetime: Lessons Learned from 15 Years as CEO of the Walt Disney Company,-- Call Sign Chaos: Learning to Lead,-- StrengthsFinder 2.0,-- Stillness Is the Key,-- She Said: Breaking the Sexual Harassment Story That Helped Ignite a Movement,-- Atomic Habits: An Easy & Proven Way to Build Good Habits & Break Bad Ones,-- Everything Is Figureoutable,-- What It Takes: Lessons in the Pursuit of Excellence,-- Rich Dad Poor Dad: What the Rich Teach Their Kids About Money That the Poor and Middle Class Do Not!,-- The Total Money Makeover: Classic Edition: A Proven Plan for Financial Fitness,-- Shut Up and Listen!: Hard Business Truths that Will Help You Succeed, ......................................................................................................................... .........................................................................................................................
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • Be the first to like this

Ruby on Rails SS09 04

  1. 1. Daniel Dengler web developer Ruby on Rails Workshop SS 2009 „Ruby on Rails“ and the Rails-Logo are registered trademarks of David Heinemeier Hansson – www.rubyonrails.org
  2. 2. 4 Ruby on Rails Eine erste Anwendung
  3. 3. Installation
  4. 4. Installation UNIX • ruby + rubygems installieren (source, apt, port, ...) • unter OSX sind ruby & rubygems bereits installiert • rails gem installieren • Terminal öffnen • (sudo) gem update --system • (sudo) gem install rails -y
  5. 5. Installation Windows • ruby + rubygems installieren (Installer) • rails gem installieren • Start > Ausführen > „cmd“ • gem update --system • gem install rails -y
  6. 6. Datenbanksystem nach Wahl • SQLite (empfohlen für Entwicklung) • MySQL • PostgreSQL (empfohlen für Produktivbetrieb) • IBM DB2 • Microsoft SQL Server • Oracle • Sybase • Firebird
  7. 7. Details zur Installation • http://www.ruby-lang.org/de/downloads/ • http://wiki.rubyonrails.org/getting-started/ installation
  8. 8. herokugarden.com Virtuelle Entwicklungsumgebung
  9. 9. Einen Account bekommen • Private Beta Version • Wer noch keinen Account hat eine kurze E-Mail an mich und ich lade die Absenderadresse ein • http://herokugarden.com/
  10. 10. Die erste Anwendung rails Zielverzeichnis rails Zielverzeichnis -d Datenbanktyp Generiert automatisch das Grundgerüst einer Rails- Anwendung im gewünschten Verzeichnis.
  11. 11. Eine Anwendung starten Im Hauptverzeichnis der Anwendung ausführen: ruby script/server ruby script/server -u (Mit Debugger zur Fehlersuche starten) Die Anwendung ist unter http://localhost:3000 erreichbar, falls das Starten erfolgreich war.
  12. 12. Der Verzeichnisbaum app Enthält die eigentlich Anwendung (MVC) • Präsentation (views & helpers) • Steuerung (controllers) • Datenmodelle (models)
  13. 13. Der Verzeichnisbaum con g Enthält Kon gurationsdateien für: • Grundeinstellungen • Umgebungen (Environments) • Datenbank (database.yml) • Routing (routes.rb)
  14. 14. Der Verzeichnisbaum db enthält Datenbank bezogene Inhalte: • Datenbankschema • Migrations
  15. 15. Der Verzeichnisbaum doc enthält die generierte Dokumentation der Anwendung lib enthält zusätzliche Bibliotheken, die nicht in app passen
  16. 16. Der Verzeichnisbaum log alle Log-Dateien der Anwendung. Sehr gut zur Fehlersuche! public alle statischen Inhalte die abgerufen werden können, wie etwa JavaScript-, CSS- oder Bild- Dateien
  17. 17. Der Verzeichnisbaum script verschiedene Tools, wie etwa den Webserver (script/server) oder Codegeneratoren (script/ generate) tmp temporäre Dateien der Anwendung
  18. 18. Der Verzeichnisbaum test enthält die automatischen Tests der Anwendung. Dies ist ein wichtiger Bestandteil für größere Webanwendungen im produktiven Umfeld. Wird im Kurs aus Zeitgründen kaum oder gar nicht behandelt werden
  19. 19. Ruby on Rails API Ruby on Rails API (durchsehen) http://api.rubyonrails.org API Dock Rails (suchen) http://apidock.com/rails
  20. 20. Wiederholung
  21. 21. Basisdatentypen • Fixnum – ganze Zahlen (1 , 3, 1000) • Bignum – große ganze Zahlen (10000000000000000) • Float – Fließkommazahlen (1.45) • String – Zeichenketten (quot;Hallo Weltquot;, 'Hallo Welt') • Symbol – Bezeichner (:name)
  22. 22. Operatoren • = Zuweisungsoperator • +, -, *, /, () Arithmetische Operatoren • ==, <, >, <=, >=, != Vergleichsoperatoren • and (&&), or (||) Logische Operatoren
  23. 23. Arrays & Hashes • Arrays [Element, Element, …] • Hashes {Schlüssel => Wert, Schlüssel => Wert, …}
  24. 24. Kontrollstrukturen • Steuern den Programmablauf • Wichtige Kontrollstrukturen in Ruby • Entscheidungen: if, unless, case • Schleifen: while, until, for, .each
  25. 25. if Bedingung Anweisungen elsif Bedingung Anweisungen else Anweisungen end unless Bedingung Anweisungen end Anweisungen if Bedingung
  26. 26. case Variable when Bedingung Anweisungen when Bedingung Anweisungen else Anweisungen end while Bedingung Anweisungen end
  27. 27. Klassen, Methoden & Objekte • Klassen beginnen mit den Schlüsselwort class und können verschiedene Methoden beinhalten • Methoden beginnen mit dem Schlüsselwort def • Die konkrete Instanz einer Klasse ist ein Objekt
  28. 28. Ergänzungen zu Abschnitt 3
  29. 29. Numeric ausgewählte Methoden Numeric ist Basisklasse für alle Zahlendatentypen Einfache mathematische Operationen: • +, -, *, / Konvertierung in andere Formate: • to_s (wandelt in String) • to_f (wandelt in Float) • to_i (wandelt in Integer)
  30. 30. Integer ausgewählte Methoden int.times block 3.times { |i| print i, quot; quot; } #>> 0 1 2 int.upto(int) block 2.upto(5) { |i| print i, quot; quot; } #>> 2 3 4 5
  31. 31. String ausgewählte Methoden str * integer quot;wquot; * 3 #=> quot;wwwquot; str + str quot;fooquot; + quot;barquot; #=> quot;foobarquot; str. capitalize quot;fOoquot;.capitalize #=> quot;Fooquot; str.upcase quot;fooquot;.upcase #=> quot;FOOquot; str.downcase quot;FOOquot;.downcase #=> quot;fooquot; str.empty? quot;quot;.empty? #=> true quot;fooquot;.empty? #=> false
  32. 32. String ausgewählte Methoden str.size quot;fooquot;.size #=> 3 str.split(str) quot;1,2,3quot;.split(quot;,quot;) #=> [1,2,3] str. capitalize quot;fOoquot;.capitalize #=> quot;Fooquot; str.upcase quot;fooquot;.upcase #=> quot;FOOquot; str.downcase quot;FOOquot;.downcase #=> quot;fooquot; str.to_i quot;123quot;.to_i #=> 123
  33. 33. Array ausgewählte Methoden arr.empty? [].empty? #=> true arr.size [6,100].size #=> 2 arr. sort [3,1,2].sort #=> [1,2,3] arr.reverse [1,2,3].reverse #=> [3,2,1] arr.uniq [1,1,2].uniq #=> [1,2] arr.join(str) [1,2,3].join(quot;-quot;) #=> quot;1-2-3quot; arr.each block [1,2].each { |i| print i, quot; quot; } #>> 1 2
  34. 34. Blöcke def blocking(&block) yield end blocking do puts quot;fooquot; end # >> foo
  35. 35. Blöcke def blocking(&block) 3.times do yield end end blocking do puts quot;fooquot; end # >> foo # >> foo # >> foo
  36. 36. Blöcke def blocking(&block) 3.times do |i| yield i end end blocking do |k| puts quot;foo #{k}quot; end # blocking {|k| puts quot;foo #{k}quot;} # >> foo 0 # >> foo 1 # >> foo 2
  37. 37. Module als Funktionssammlung module ModA def dance puts quot;dance from #{self.class}quot; end end class B include ModA end class C include ModA end b = B.new b.dance # >> dance from B c = C.new c.dance # >> dance from C
  38. 38. Module als Namensräume module ModA class A def hi puts quot;Hi im from ModAquot; end end end module ModB class A def hi puts quot;Hi im from ModBquot; end end end b = ModA::A.new b.hi # >> Hi from ModA c = ModB::A.new c.hi # >> Hi from ModB
  39. 39. Ruby API Ruby Core API http://www.ruby-doc.org/core/ Ruby Standard Library http://www.ruby-doc.org/stdlib/ API Dock Ruby http://apidock.com/ruby
  40. 40. Übung
  41. 41. Ruby Skripte ausführen • Interpreter • ruby skriptname.rb • Interactive Shell • irb skriptname.rb
  42. 42. Online Ruby Interpreter • http://tryruby.hobix.com • Geeignet um den Quellcode der Beispiele selbst zu testen und sich mit der Sprache vertraut zu machen • Bietet ein Ruby-Lern-Tutorial aus 8 Blöcken • Bitte jetzt anfangen (und zu Hause fertig machen!) • Lesen und merken sie sich die Anweisungen des Anfangs, falls sie stecken bleiben sollten! ( help Kapitelnummer, Ctrl + D)
  43. 43. ?

×