Ruby on Rails - An overview

1,429 views

Published on

A presentantion about ruby on rails, made by 2 students of IT and Management. Explains the basics of the ruby on rails web application development.

Published in: Education, Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
1,429
On SlideShare
0
From Embeds
0
Number of Embeds
12
Actions
Shares
0
Downloads
33
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Ruby on Rails - An overview

  1. 1. Τμήμα Διοικητικής Επιστήμης και Τετνολογίας Οικονομικό Πανεπιστήμιο ΑθηνώνRUBYONRAILSΘωμάς ΑσίκηςΚωνσταντίνος Σταύροσ
  2. 2. AN INTRODUCTION…Some general things:o Ruby is the programming language.o Rails is a Web DevelopmentFramework on top of Ruby.
  3. 3. ABOUT RUBYRuby is:o Dynamic – executes on runtime.o Reflective – modifies itself on runtime.o General purpose – can be used for anyprogramming purpose.oOpen Source…o Object oriented…o High-Level…
  4. 4. THE RUBY STORYDeveloped in the early-1990s.Created by Yukihiro "Matz" Matsumoto.Originates from Japan.First released on February 1995.Next major release, Ruby 2.0expected on 2013.
  5. 5. TECHNICAL INFOInterprets to C.Uses the best practices from Perl, Smalltalk, Eiffel, and Lisp.Ruby follows the principle of least astonishment (POLA).Works as expected.Alternative implementations of Ruby,including YARV, JRuby, Rubinius, IronRuby,MacRuby, and HotRuby.
  6. 6. INSTALLING RUBYDepending on tour system there aremany different installation ways.The 3 basic Ways are:1. You can compile it from source.2. You can install it through 3rd party tools, RVM – Linux/MacOS, Ruby Installer – Windows.3. Via package managers: Apt-get install, yum install, brew install, pacman –S etc.
  7. 7. FILE EXTENSIONSThe most popular file extensions of Ruby (and alsoRails) files are:o .rb the Ruby class files.o .gem Ruby package files that may containRuby programs and libraries.o .yml data mapping files.o .html.erb Ruby html files.
  8. 8. DO YOU SPEAK RUBY?Ruby is a scripting language, which has onegoal:To be programmer friendly.So its expressive, and closer to physicallanguage.
  9. 9. SOME RUBY TALKSomething no one ever seen before…Let’s do an innovative Hello World example:puts "Hello World!"
  10. 10. RUBY LOGICIn Ruby Everything is an object. There are noprimitive types. Lines and | are code seperators.No need to declare variable types. For exampe:@name #a variable@name = 2 #a number@name = “Kaiser Chiefs” #a String@name = 1..52 #a range@name = [“Rails”,12,[6,7,9],3..53] #a collection
  11. 11. RUBY LOGIC AGAINA class exampleclass Person attr_accessor :nameendClass instance Examplebob = Person.newbob.name = “Bob the Builder”Blocks example – blocks are anonymous functionsworkers = [Bob, Maria, George, Sylvia]for person in workers do puts person.nameendworkers.each do |person| puts person.nameend
  12. 12. RUBY LOGIC AGAIN AND AGAINIterrators examplebest_workers = workers.select{|person|person.name.include? ”a”}Hashes are a great way to store things:Hash examplefav_djs = {“tiesto” => 8, “deadmau5” => 6,“kaskade” => 3, “benassi” => 7}fav_djs[“deadmau5”] >> 6fav_djs[“benassi”]+=2 >> 9fav_djs[“afrojack”] = 5
  13. 13. HOW TO HACK SOMETHING USING RUBY…Now we know enough to…
  14. 14. SO? WHAT’S RAILS?•Open source• MVC Web Framework•Optimized for programmer happiness.•Developed for database backedweb applications,.•Very AGILE
  15. 15. FOR STARTERSRails is a ruby web framework.It was designed by David Heinemeier Hansson.Was released as an open source project on 2004.And joined Mac on 2007.
  16. 16. MVC ON RAILS
  17. 17. SOMETIMES PICTURES AREN’T ENOUGH• This pattern splits the view (also called the presentation) in"dumb" templates that are primarily responsible for insertingpre-built data in between HTML tags.• The model contains the "smart" domain objects (such asAccount, Product, Person, Post) that holds all the businesslogic and knows how to persist themselves to a database.• The controller handles the incomingrequests (such as Save New Account, Update Product, Show Post) bymanipulating the model and directingdata to the view.
  18. 18. RAILS FIGHTS FORWrite Less Do More.DRY – Don’t Repeat Yourself.COC – Convention over Configuration.REST- Representational StateTransfer.
  19. 19. HOW EASY IS TO LEARN RAILS?
  20. 20. RAILS CAPABILITIES•ORM : Object Relational Mapping.•CRUD: Create Read Update Deletea Database.•Both BDD and TDD: Behavior and Test DrivenDevelopment.•Ajax and Web Services.•Meta Programming.
  21. 21. WHAT IS ORM?Active Record (ORM)An ORM layer built-in maps classes to tables so :•Every row is an object.•Every column is an object attribute.Also it uses conventions to minimizeconfiguration.
  22. 22. COMPATIBILITYMost Platforms :Linux, Windows, MacOs etc.Most Databases :MySQL, Sqlite, NoSQL etc.A lot of Web Servers :Nginx, Apache, Passenger etc.
  23. 23. RAILS VS JAVA AND PHP
  24. 24. GETTING STARTEDAll Rails Apps use the samestructure.No matter the editor or IDE youare using, the projects havethe same build.The newer versions alwayssupport the older.
  25. 25. RAILS 3.0 PROJECT STRUCTURE
  26. 26. DEVELOPER TOOLSEditors: vim, gedit, Textmateand moreIDEs: RubyMine, Eclipse withplugin, Aptana, Radrails,3rdRail
  27. 27. GETTING STARTEDInstallation, 3 steps:1. Open your terminal, no matter the OS you are using.2. Type: gem install rails3. Press enter, sit back and enjoy.
  28. 28. BUILD YOUR FIRST APP1. Open your terminal and cd to the folder where you want to place your project .2. Type & enter: rails new Project_Name3. Type & enter: rails s4. Visit your localhost:3000, from your browser5. You can see your first rails app running
  29. 29. BUILD YOUR FIRST APPThis is what you would see…
  30. 30. FAMOUS WEBSITES ON RAILS
  31. 31. FAMOUS WEBSITES ON RAILS
  32. 32. FAMOUS WEBSITES ON RAILS
  33. 33. FAMOUS WEBSITES ON RAILS
  34. 34. USEFUL LINKS• http://rubyonrails.org/• http://railsforzombies.org/• http://ruby.railstutorial.org/• http://www.aptana.com/products/radrails• http://railscasts.com/• http://www.ruby-forum.com/forum/rails• http://www.google.gr/• http://www.slideshare.net/
  35. 35. AND SOME PERSONAL TIPSDon’t be afraid to search and try, it pays… a lot.
  36. 36. ANY QUESTIONS ??Don’t worry guys,we got this.

×