SlideShare a Scribd company logo
Τμήμα Διοικητικής Επιστήμης και Τετνολογίας
       Οικονομικό Πανεπιστήμιο Αθηνών




RUBY
ON
RAILS
Θωμάς Ασίκης
Κωνσταντίνος Σταύροσ
AN INTRODUCTION…

Some general things:

o Ruby is the programming language.

o Rails is a Web Development
Framework on top of Ruby.
ABOUT RUBY
Ruby is:

o Dynamic – executes on runtime.

o Reflective – modifies itself on runtime.

o General purpose – can be used for any
programming purpose.

oOpen Source…

o Object oriented…

o High-Level…
THE RUBY STORY
Developed in the early-1990s.

Created by Yukihiro "Matz" Matsumoto.

Originates from Japan.

First released on February 1995.

Next major release, Ruby 2.0
expected on 2013.
TECHNICAL INFO
Interprets 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.
INSTALLING RUBY
Depending on tour system there are
many 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.
FILE EXTENSIONS
The most popular file extensions of Ruby (and also
Rails) files are:

o .rb the Ruby class files.

o .gem Ruby package files that may contain
Ruby programs and libraries.

o .yml data mapping files.

o .html.erb Ruby html files.
DO YOU SPEAK RUBY?
Ruby is a scripting language, which has one
goal:

To be programmer friendly.

So it's expressive, and closer to physical
language.
SOME RUBY TALK
Something no one ever seen before…
Let’s do an innovative Hello World example:

puts "Hello World!"
RUBY LOGIC
In Ruby Everything is an object. There are no
primitive 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
RUBY LOGIC AGAIN
A class example
class Person
        attr_accessor :name
end

Class instance Example
bob = Person.new
bob.name = “Bob the Builder”

Blocks example – blocks are anonymous functions
workers = [Bob, Maria, George, Sylvia]
for person in workers do
        puts person.name
end
workers.each do |person|
        puts person.name
end
RUBY LOGIC AGAIN AND AGAIN
Iterrators example
best_workers = workers.select{|person|
person.name.include? ”a”}

Hashes are a great way to store things:

Hash example
fav_djs = {“tiesto” => 8, “deadmau5” => 6,
“kaskade” => 3, “benassi” => 7}
fav_djs[“deadmau5”]        >> 6
fav_djs[“benassi”]+=2       >> 9
fav_djs[“afrojack”] = 5
HOW TO HACK SOMETHING USING RUBY…

Now we know enough to…
SO? WHAT’S RAILS?
•Open source

• MVC Web Framework

•Optimized for programmer happiness.

•Developed for database backed
web applications,.

•Very AGILE
FOR STARTERS
Rails 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.
MVC ON RAILS
SOMETIMES PICTURES AREN’T ENOUGH
• This pattern splits the view (also called the presentation) in
"dumb" templates that are primarily responsible for inserting
pre-built data in between HTML tags.

• The model contains the "smart" domain objects (such as
Account, Product, Person, Post) that holds all the business
logic and knows how to persist themselves to a database.

• The controller handles the incoming
requests (such as Save New Account,
 Update Product, Show Post) by
manipulating the model and directing
data to the view.
RAILS FIGHTS FOR
Write Less Do More.

DRY – Don’t Repeat Yourself.

COC – Convention over Configuration.

REST- Representational State
Transfer.
HOW EASY IS TO LEARN RAILS?
RAILS CAPABILITIES
•ORM : Object Relational Mapping.

•CRUD: Create Read Update Delete
a Database.

•Both BDD and TDD: Behavior and Test Driven
Development.

•Ajax and Web Services.

•Meta Programming.
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 minimize
configuration.
COMPATIBILITY
Most Platforms :
Linux, Windows, MacOs etc.

Most Databases :
MySQL, Sqlite, NoSQL etc.

A lot of Web Servers :
Nginx, Apache, Passenger etc.
RAILS VS JAVA AND PHP
GETTING STARTED

All Rails Apps use the same
structure.

No matter the editor or IDE you
are using, the projects have
the same build.

The newer versions always
support the older.
RAILS 3.0 PROJECT STRUCTURE
DEVELOPER TOOLS

Editors: vim, gedit, Textmate
and more

IDEs: RubyMine, Eclipse with
plugin, Aptana, Radrails,
3rdRail
GETTING STARTED

Installation, 3 steps:

1. Open your terminal, no
   matter the OS you are
   using.
2. Type:
   gem install rails
3. Press enter, sit back and
   enjoy.
BUILD YOUR FIRST APP

1. Open your terminal and cd
   to the folder where you
   want to place your project .
2. Type & enter:
   rails new Project_Name
3. Type & enter:
   rails s
4. Visit your localhost:3000,
   from your browser
5. You can see your first rails
   app running
BUILD YOUR FIRST APP
This is what you would see…
FAMOUS WEBSITES ON RAILS
FAMOUS WEBSITES ON RAILS
FAMOUS WEBSITES ON RAILS
FAMOUS WEBSITES ON RAILS
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/
AND SOME PERSONAL TIPS
Don’t be afraid to search and try, it pays… a lot.
ANY QUESTIONS ??



Don’t worry guys,
we got this.

More Related Content

What's hot

Dev streams2
Dev streams2Dev streams2
Dev streams2
David Mc Donagh
 
How to dockerize rails application compose and rails tutorial
How to dockerize rails application compose and rails tutorialHow to dockerize rails application compose and rails tutorial
How to dockerize rails application compose and rails tutorial
Katy Slemon
 
AngularJS meets Rails
AngularJS meets RailsAngularJS meets Rails
AngularJS meets Rails
Elena Torró
 
Introduction to Ruby on Rails
Introduction to Ruby on RailsIntroduction to Ruby on Rails
Introduction to Ruby on RailsManoj Kumar
 
How angularjs saves rails
How angularjs saves railsHow angularjs saves rails
How angularjs saves rails
Michael He
 
Ruby On Grape
Ruby On GrapeRuby On Grape
Ruby On Grape
Andrii Furmanets
 
Web a Quebec - JS Debugging
Web a Quebec - JS DebuggingWeb a Quebec - JS Debugging
Web a Quebec - JS Debugging
Rami Sayar
 
Web application intro
Web application introWeb application intro
Web application intro
Tobias Pfeiffer
 
Webpack & EcmaScript 6 (Webelement #32)
Webpack & EcmaScript 6 (Webelement #32)Webpack & EcmaScript 6 (Webelement #32)
Webpack & EcmaScript 6 (Webelement #32)
srigi
 
Ruby w/o Rails (Олександр Сімонов)
Ruby w/o Rails (Олександр Сімонов)Ruby w/o Rails (Олександр Сімонов)
Ruby w/o Rails (Олександр Сімонов)
Fwdays
 
An Intense Overview of the React Ecosystem
An Intense Overview of the React EcosystemAn Intense Overview of the React Ecosystem
An Intense Overview of the React Ecosystem
Rami Sayar
 
RoR 101: Session 2
RoR 101: Session 2RoR 101: Session 2
RoR 101: Session 2
Rory Gianni
 
PLAT-8 Spring Web Scripts and Spring Surf
PLAT-8 Spring Web Scripts and Spring SurfPLAT-8 Spring Web Scripts and Spring Surf
PLAT-8 Spring Web Scripts and Spring Surf
Alfresco Software
 
Ruby on Rails + AngularJS + Twitter Bootstrap
Ruby on Rails + AngularJS + Twitter BootstrapRuby on Rails + AngularJS + Twitter Bootstrap
Ruby on Rails + AngularJS + Twitter Bootstrap
Marcio Marinho
 
Build Your Own CMS with Apache Sling
Build Your Own CMS with Apache SlingBuild Your Own CMS with Apache Sling
Build Your Own CMS with Apache SlingBob Paulin
 
RoR 101: Session 5
RoR 101: Session 5RoR 101: Session 5
RoR 101: Session 5
Rory Gianni
 
SPA using Rails & Backbone
SPA using Rails & BackboneSPA using Rails & Backbone
SPA using Rails & Backbone
Ashan Fernando
 
RoR 101: Session 6
RoR 101: Session 6RoR 101: Session 6
RoR 101: Session 6
Rory Gianni
 
Spring Boot Update
Spring Boot UpdateSpring Boot Update
Spring Boot Update
Sergi Almar i Graupera
 

What's hot (20)

Dev streams2
Dev streams2Dev streams2
Dev streams2
 
How to dockerize rails application compose and rails tutorial
How to dockerize rails application compose and rails tutorialHow to dockerize rails application compose and rails tutorial
How to dockerize rails application compose and rails tutorial
 
AngularJS meets Rails
AngularJS meets RailsAngularJS meets Rails
AngularJS meets Rails
 
Introduction to Ruby on Rails
Introduction to Ruby on RailsIntroduction to Ruby on Rails
Introduction to Ruby on Rails
 
How angularjs saves rails
How angularjs saves railsHow angularjs saves rails
How angularjs saves rails
 
Ruby On Grape
Ruby On GrapeRuby On Grape
Ruby On Grape
 
Web a Quebec - JS Debugging
Web a Quebec - JS DebuggingWeb a Quebec - JS Debugging
Web a Quebec - JS Debugging
 
Web application intro
Web application introWeb application intro
Web application intro
 
Webpack & EcmaScript 6 (Webelement #32)
Webpack & EcmaScript 6 (Webelement #32)Webpack & EcmaScript 6 (Webelement #32)
Webpack & EcmaScript 6 (Webelement #32)
 
Ruby w/o Rails (Олександр Сімонов)
Ruby w/o Rails (Олександр Сімонов)Ruby w/o Rails (Олександр Сімонов)
Ruby w/o Rails (Олександр Сімонов)
 
An Intense Overview of the React Ecosystem
An Intense Overview of the React EcosystemAn Intense Overview of the React Ecosystem
An Intense Overview of the React Ecosystem
 
RoR 101: Session 2
RoR 101: Session 2RoR 101: Session 2
RoR 101: Session 2
 
PLAT-8 Spring Web Scripts and Spring Surf
PLAT-8 Spring Web Scripts and Spring SurfPLAT-8 Spring Web Scripts and Spring Surf
PLAT-8 Spring Web Scripts and Spring Surf
 
Ruby on Rails + AngularJS + Twitter Bootstrap
Ruby on Rails + AngularJS + Twitter BootstrapRuby on Rails + AngularJS + Twitter Bootstrap
Ruby on Rails + AngularJS + Twitter Bootstrap
 
Build Your Own CMS with Apache Sling
Build Your Own CMS with Apache SlingBuild Your Own CMS with Apache Sling
Build Your Own CMS with Apache Sling
 
RoR 101: Session 5
RoR 101: Session 5RoR 101: Session 5
RoR 101: Session 5
 
Sinatra
SinatraSinatra
Sinatra
 
SPA using Rails & Backbone
SPA using Rails & BackboneSPA using Rails & Backbone
SPA using Rails & Backbone
 
RoR 101: Session 6
RoR 101: Session 6RoR 101: Session 6
RoR 101: Session 6
 
Spring Boot Update
Spring Boot UpdateSpring Boot Update
Spring Boot Update
 

Similar to Ruby on Rails - An overview

Rubyonrails 120409061835-phpapp02
Rubyonrails 120409061835-phpapp02Rubyonrails 120409061835-phpapp02
Rubyonrails 120409061835-phpapp02sagaroceanic11
 
FGCU Camp Talk
FGCU Camp TalkFGCU Camp Talk
FGCU Camp Talk
Mark Brooks
 
Ruby On Rails Presentation
Ruby On Rails PresentationRuby On Rails Presentation
Ruby On Rails Presentation
Paul Pajo
 
Why Ruby?
Why Ruby? Why Ruby?
Why Ruby?
IT Weekend
 
Ruby On Rails
Ruby On RailsRuby On Rails
Ruby On Rails
iradarji
 
Ruby on Rails : First Mile
Ruby on Rails : First MileRuby on Rails : First Mile
Ruby on Rails : First Mile
Gourab Mitra
 
Ruby On Rails - Rochester K Linux User Group
Ruby On Rails - Rochester K Linux User GroupRuby On Rails - Rochester K Linux User Group
Ruby On Rails - Rochester K Linux User Group
Jose de Leon
 
Ruby on Rails
Ruby on RailsRuby on Rails
Ruby on Rails
Momentum Design Lab
 
Viridians on Rails
Viridians on RailsViridians on Rails
Viridians on Rails
Viridians
 
Ruby on Rails Introduction M&P - IT Skill Development Program 07
Ruby on Rails Introduction M&P - IT Skill Development Program 07Ruby on Rails Introduction M&P - IT Skill Development Program 07
Ruby on Rails Introduction M&P - IT Skill Development Program 07
Muhammad Sunny ✈
 
Introduction to Ruby on Rails
Introduction to Ruby on RailsIntroduction to Ruby on Rails
Introduction to Ruby on Rails
mithunsasidharan
 
Ruby Rails Web Development.pdf
Ruby Rails Web Development.pdfRuby Rails Web Development.pdf
Ruby Rails Web Development.pdf
Ayesha Siddika
 
Ruby And Ruby On Rails
Ruby And Ruby On RailsRuby And Ruby On Rails
Ruby And Ruby On Rails
AkNirojan
 
Ruby on Rails (RoR) as a back-end processor for Apex
Ruby on Rails (RoR) as a back-end processor for Apex Ruby on Rails (RoR) as a back-end processor for Apex
Ruby on Rails (RoR) as a back-end processor for Apex
Espen Brækken
 
Introduction To Rails
Introduction To RailsIntroduction To Rails
Introduction To Rails
Eric Gruber
 
Ruby Rails Web Development.pdf
Ruby Rails Web Development.pdfRuby Rails Web Development.pdf
Ruby Rails Web Development.pdf
SEO expate Bangladesh Ltd
 

Similar to Ruby on Rails - An overview (20)

Rubyonrails 120409061835-phpapp02
Rubyonrails 120409061835-phpapp02Rubyonrails 120409061835-phpapp02
Rubyonrails 120409061835-phpapp02
 
FGCU Camp Talk
FGCU Camp TalkFGCU Camp Talk
FGCU Camp Talk
 
Ruby On Rails Presentation
Ruby On Rails PresentationRuby On Rails Presentation
Ruby On Rails Presentation
 
ruby pentest
ruby pentestruby pentest
ruby pentest
 
Why Ruby?
Why Ruby? Why Ruby?
Why Ruby?
 
Ruby On Rails
Ruby On RailsRuby On Rails
Ruby On Rails
 
Ruby on Rails : First Mile
Ruby on Rails : First MileRuby on Rails : First Mile
Ruby on Rails : First Mile
 
Ruby On Rails - Rochester K Linux User Group
Ruby On Rails - Rochester K Linux User GroupRuby On Rails - Rochester K Linux User Group
Ruby On Rails - Rochester K Linux User Group
 
Ruby on Rails
Ruby on RailsRuby on Rails
Ruby on Rails
 
Viridians on Rails
Viridians on RailsViridians on Rails
Viridians on Rails
 
Ruby on Rails Introduction M&P - IT Skill Development Program 07
Ruby on Rails Introduction M&P - IT Skill Development Program 07Ruby on Rails Introduction M&P - IT Skill Development Program 07
Ruby on Rails Introduction M&P - IT Skill Development Program 07
 
Introduction to Ruby on Rails
Introduction to Ruby on RailsIntroduction to Ruby on Rails
Introduction to Ruby on Rails
 
Ruby on rails
Ruby on railsRuby on rails
Ruby on rails
 
Ruby on Rails
Ruby on Rails Ruby on Rails
Ruby on Rails
 
Ruby on rails
Ruby on railsRuby on rails
Ruby on rails
 
Ruby Rails Web Development.pdf
Ruby Rails Web Development.pdfRuby Rails Web Development.pdf
Ruby Rails Web Development.pdf
 
Ruby And Ruby On Rails
Ruby And Ruby On RailsRuby And Ruby On Rails
Ruby And Ruby On Rails
 
Ruby on Rails (RoR) as a back-end processor for Apex
Ruby on Rails (RoR) as a back-end processor for Apex Ruby on Rails (RoR) as a back-end processor for Apex
Ruby on Rails (RoR) as a back-end processor for Apex
 
Introduction To Rails
Introduction To RailsIntroduction To Rails
Introduction To Rails
 
Ruby Rails Web Development.pdf
Ruby Rails Web Development.pdfRuby Rails Web Development.pdf
Ruby Rails Web Development.pdf
 

Recently uploaded

The Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdfThe Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdf
kaushalkr1407
 
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXPhrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
MIRIAMSALINAS13
 
Operation Blue Star - Saka Neela Tara
Operation Blue Star   -  Saka Neela TaraOperation Blue Star   -  Saka Neela Tara
Operation Blue Star - Saka Neela Tara
Balvir Singh
 
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCECLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
BhavyaRajput3
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
MysoreMuleSoftMeetup
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
Vikramjit Singh
 
Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
DeeptiGupta154
 
Introduction to Quality Improvement Essentials
Introduction to Quality Improvement EssentialsIntroduction to Quality Improvement Essentials
Introduction to Quality Improvement Essentials
Excellence Foundation for South Sudan
 
How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...
Jisc
 
Thesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.pptThesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.ppt
EverAndrsGuerraGuerr
 
Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
Thiyagu K
 
How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17
Celine George
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
Pavel ( NSTU)
 
Ethnobotany and Ethnopharmacology ......
Ethnobotany and Ethnopharmacology ......Ethnobotany and Ethnopharmacology ......
Ethnobotany and Ethnopharmacology ......
Ashokrao Mane college of Pharmacy Peth-Vadgaon
 
The French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free downloadThe French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free download
Vivekanand Anglo Vedic Academy
 
Cambridge International AS A Level Biology Coursebook - EBook (MaryFosbery J...
Cambridge International AS  A Level Biology Coursebook - EBook (MaryFosbery J...Cambridge International AS  A Level Biology Coursebook - EBook (MaryFosbery J...
Cambridge International AS A Level Biology Coursebook - EBook (MaryFosbery J...
AzmatAli747758
 
The approach at University of Liverpool.pptx
The approach at University of Liverpool.pptxThe approach at University of Liverpool.pptx
The approach at University of Liverpool.pptx
Jisc
 
Fish and Chips - have they had their chips
Fish and Chips - have they had their chipsFish and Chips - have they had their chips
Fish and Chips - have they had their chips
GeoBlogs
 
Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345
beazzy04
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
Mohd Adib Abd Muin, Senior Lecturer at Universiti Utara Malaysia
 

Recently uploaded (20)

The Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdfThe Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdf
 
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXPhrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
 
Operation Blue Star - Saka Neela Tara
Operation Blue Star   -  Saka Neela TaraOperation Blue Star   -  Saka Neela Tara
Operation Blue Star - Saka Neela Tara
 
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCECLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
 
Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
 
Introduction to Quality Improvement Essentials
Introduction to Quality Improvement EssentialsIntroduction to Quality Improvement Essentials
Introduction to Quality Improvement Essentials
 
How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...
 
Thesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.pptThesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.ppt
 
Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
 
How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
 
Ethnobotany and Ethnopharmacology ......
Ethnobotany and Ethnopharmacology ......Ethnobotany and Ethnopharmacology ......
Ethnobotany and Ethnopharmacology ......
 
The French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free downloadThe French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free download
 
Cambridge International AS A Level Biology Coursebook - EBook (MaryFosbery J...
Cambridge International AS  A Level Biology Coursebook - EBook (MaryFosbery J...Cambridge International AS  A Level Biology Coursebook - EBook (MaryFosbery J...
Cambridge International AS A Level Biology Coursebook - EBook (MaryFosbery J...
 
The approach at University of Liverpool.pptx
The approach at University of Liverpool.pptxThe approach at University of Liverpool.pptx
The approach at University of Liverpool.pptx
 
Fish and Chips - have they had their chips
Fish and Chips - have they had their chipsFish and Chips - have they had their chips
Fish and Chips - have they had their chips
 
Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
 

Ruby on Rails - An overview

  • 1. Τμήμα Διοικητικής Επιστήμης και Τετνολογίας Οικονομικό Πανεπιστήμιο Αθηνών RUBY ON RAILS Θωμάς Ασίκης Κωνσταντίνος Σταύροσ
  • 2. AN INTRODUCTION… Some general things: o Ruby is the programming language. o Rails is a Web Development Framework on top of Ruby.
  • 3. ABOUT RUBY Ruby is: o Dynamic – executes on runtime. o Reflective – modifies itself on runtime. o General purpose – can be used for any programming purpose. oOpen Source… o Object oriented… o High-Level…
  • 4. THE RUBY STORY Developed in the early-1990s. Created by Yukihiro "Matz" Matsumoto. Originates from Japan. First released on February 1995. Next major release, Ruby 2.0 expected on 2013.
  • 5. TECHNICAL INFO Interprets 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. INSTALLING RUBY Depending on tour system there are many 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. FILE EXTENSIONS The most popular file extensions of Ruby (and also Rails) files are: o .rb the Ruby class files. o .gem Ruby package files that may contain Ruby programs and libraries. o .yml data mapping files. o .html.erb Ruby html files.
  • 8. DO YOU SPEAK RUBY? Ruby is a scripting language, which has one goal: To be programmer friendly. So it's expressive, and closer to physical language.
  • 9. SOME RUBY TALK Something no one ever seen before… Let’s do an innovative Hello World example: puts "Hello World!"
  • 10. RUBY LOGIC In Ruby Everything is an object. There are no primitive 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. RUBY LOGIC AGAIN A class example class Person attr_accessor :name end Class instance Example bob = Person.new bob.name = “Bob the Builder” Blocks example – blocks are anonymous functions workers = [Bob, Maria, George, Sylvia] for person in workers do puts person.name end workers.each do |person| puts person.name end
  • 12. RUBY LOGIC AGAIN AND AGAIN Iterrators example best_workers = workers.select{|person| person.name.include? ”a”} Hashes are a great way to store things: Hash example fav_djs = {“tiesto” => 8, “deadmau5” => 6, “kaskade” => 3, “benassi” => 7} fav_djs[“deadmau5”] >> 6 fav_djs[“benassi”]+=2 >> 9 fav_djs[“afrojack”] = 5
  • 13. HOW TO HACK SOMETHING USING RUBY… Now we know enough to…
  • 14.
  • 15. SO? WHAT’S RAILS? •Open source • MVC Web Framework •Optimized for programmer happiness. •Developed for database backed web applications,. •Very AGILE
  • 16. FOR STARTERS Rails 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.
  • 18. SOMETIMES PICTURES AREN’T ENOUGH • This pattern splits the view (also called the presentation) in "dumb" templates that are primarily responsible for inserting pre-built data in between HTML tags. • The model contains the "smart" domain objects (such as Account, Product, Person, Post) that holds all the business logic and knows how to persist themselves to a database. • The controller handles the incoming requests (such as Save New Account, Update Product, Show Post) by manipulating the model and directing data to the view.
  • 19. RAILS FIGHTS FOR Write Less Do More. DRY – Don’t Repeat Yourself. COC – Convention over Configuration. REST- Representational State Transfer.
  • 20. HOW EASY IS TO LEARN RAILS?
  • 21. RAILS CAPABILITIES •ORM : Object Relational Mapping. •CRUD: Create Read Update Delete a Database. •Both BDD and TDD: Behavior and Test Driven Development. •Ajax and Web Services. •Meta Programming.
  • 22. 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 minimize configuration.
  • 23. COMPATIBILITY Most Platforms : Linux, Windows, MacOs etc. Most Databases : MySQL, Sqlite, NoSQL etc. A lot of Web Servers : Nginx, Apache, Passenger etc.
  • 24. RAILS VS JAVA AND PHP
  • 25. GETTING STARTED All Rails Apps use the same structure. No matter the editor or IDE you are using, the projects have the same build. The newer versions always support the older.
  • 26. RAILS 3.0 PROJECT STRUCTURE
  • 27. DEVELOPER TOOLS Editors: vim, gedit, Textmate and more IDEs: RubyMine, Eclipse with plugin, Aptana, Radrails, 3rdRail
  • 28. GETTING STARTED Installation, 3 steps: 1. Open your terminal, no matter the OS you are using. 2. Type: gem install rails 3. Press enter, sit back and enjoy.
  • 29. BUILD YOUR FIRST APP 1. Open your terminal and cd to the folder where you want to place your project . 2. Type & enter: rails new Project_Name 3. Type & enter: rails s 4. Visit your localhost:3000, from your browser 5. You can see your first rails app running
  • 30. BUILD YOUR FIRST APP This is what you would see…
  • 35. 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/
  • 36. AND SOME PERSONAL TIPS Don’t be afraid to search and try, it pays… a lot.
  • 37. ANY QUESTIONS ?? Don’t worry guys, we got this.