ruby on rails intro
DESCRIPTION
An introduction of Ruby on Rails for non-programmers.TRANSCRIPT
![Page 2: Ruby on rails intro](https://reader033.vdocuments.mx/reader033/viewer/2022060109/5555ab2ed8b42a52568b490b/html5/thumbnails/2.jpg)
What is it?What is it?
![Page 3: Ruby on rails intro](https://reader033.vdocuments.mx/reader033/viewer/2022060109/5555ab2ed8b42a52568b490b/html5/thumbnails/3.jpg)
++
![Page 4: Ruby on rails intro](https://reader033.vdocuments.mx/reader033/viewer/2022060109/5555ab2ed8b42a52568b490b/html5/thumbnails/4.jpg)
Before we start!Before we start!Let’s talk about…
![Page 5: Ruby on rails intro](https://reader033.vdocuments.mx/reader033/viewer/2022060109/5555ab2ed8b42a52568b490b/html5/thumbnails/5.jpg)
What is Programming?What is Programming?
• Make the computer work for you in a systematic way based on pre-defined rules
• The more trivial routines you have, the more powerful the computer can be
• Depending on the level of abstraction, there are high-level and low-level programming languages
• No matter what language you use, there are commonly 5 types of statements
![Page 6: Ruby on rails intro](https://reader033.vdocuments.mx/reader033/viewer/2022060109/5555ab2ed8b42a52568b490b/html5/thumbnails/6.jpg)
They are..They are..• Calculations
=> arithmetic or logical operations• Assignments
=> set a name to memorize something• Conditionals
=> if, unless and cases• Iterations
=> do, while, and until loops• Controls
=> sending hardware signals
![Page 7: Ruby on rails intro](https://reader033.vdocuments.mx/reader033/viewer/2022060109/5555ab2ed8b42a52568b490b/html5/thumbnails/7.jpg)
What is Web?What is Web?
• A client-server computing model, of which data transmission is based on the request-response protocol (HTTP)
• The packets are sent in text without encryption• Stateless nature, connection open and close in every
request-response cycle• No request, no response
![Page 8: Ruby on rails intro](https://reader033.vdocuments.mx/reader033/viewer/2022060109/5555ab2ed8b42a52568b490b/html5/thumbnails/8.jpg)
RubyRuby
![Page 9: Ruby on rails intro](https://reader033.vdocuments.mx/reader033/viewer/2022060109/5555ab2ed8b42a52568b490b/html5/thumbnails/9.jpg)
Ruby LanguageRuby Language
• Created by Yukihiro Matsumoto(aka. Matz) in 1993• Flexible syntax, make programmers happy• Dynamic typing, everything is an object• Support both OOP and FP styles• Powerful meta-programming capabilities• Good for constructing DSL• Encourage software test• Site: http://www.ruby-lang.org/
![Page 10: Ruby on rails intro](https://reader033.vdocuments.mx/reader033/viewer/2022060109/5555ab2ed8b42a52568b490b/html5/thumbnails/10.jpg)
RailsRails
![Page 11: Ruby on rails intro](https://reader033.vdocuments.mx/reader033/viewer/2022060109/5555ab2ed8b42a52568b490b/html5/thumbnails/11.jpg)
Rails FrameworkRails Framework• Created by David H. Hansson(aka. DHH) in 2004• Full stack framework• MVC design patterns• Support RESTful architecture• Convention Over Configuration• Don’t Repeat Yourself• Encourage Agile methodology• Site: http://rubyonrails.org/
![Page 12: Ruby on rails intro](https://reader033.vdocuments.mx/reader033/viewer/2022060109/5555ab2ed8b42a52568b490b/html5/thumbnails/12.jpg)
Full StackFull Stack
• Built-in app server• Model => ActiveRecord• Controller => ActionController• View => ActionView• Mailer => ActionMailer• Database adapters• Test cases and fixtures support
![Page 13: Ruby on rails intro](https://reader033.vdocuments.mx/reader033/viewer/2022060109/5555ab2ed8b42a52568b490b/html5/thumbnails/13.jpg)
Model-View-ControllerModel-View-Controller
![Page 14: Ruby on rails intro](https://reader033.vdocuments.mx/reader033/viewer/2022060109/5555ab2ed8b42a52568b490b/html5/thumbnails/14.jpg)
Convention Over ConfigurationConvention Over Configuration
• Project files layout => all your code goes in app/ => configuration files in config/ => database migrations in db/ => other libraries in lib/ => static resource files in public/ => app test files in test/
• Naming conventions => table name map to model name => column name map to model attribute name => controller action map to view template
![Page 15: Ruby on rails intro](https://reader033.vdocuments.mx/reader033/viewer/2022060109/5555ab2ed8b42a52568b490b/html5/thumbnails/15.jpg)
Don’t Repeat YourselfDon’t Repeat Yourself
• Code generators => generate project => generate model with db migration => generate controller with views
• Handy helper methods => JavaScript helpers => Form helpers
• Sensible core extensions• Rake automation tasks• Use plug-ins and gems