SlideShare uma empresa Scribd logo
1 de 6
Aniruddha S Deshpande
                                                                                   Arlington,Texas, USA
                                                                                         1-817-714-7899
                                                                                anides84@gmail.com
                                        Ruby on Rails
Ruby on Rails is an extremely productive web application framework written in Ruby by David
Heinemeier Hansson. This is a open source Ruby framework for developing database-backed web
applications. Ruby on Rails has gained popularity in the enterprise development community among
both programmers and system managers. As an open source platform, Ruby is proving to offer a
number of advantages for powering enterprise applications, not the least of which is a shorter
development time for robust applications and the creation of denser code that's easy to work with and
maintain.

What is Ruby?

       A High Level Programming Language
       Interpreted like Perl, Python
       Object-Oriented like Java
       Easy to learn.
       Open source (very liberal license) Rich libraries
       Very easy to extend
       Less Coding with fewer bugs
       Large and Helpful community


What is Rails?
       An extremely productive web-application framework.
       Includes everything needed to create a database-driven web application using the Model-
        View-Controller pattern.
       Requires fewer total lines of code than other frameworks spend setting up their XML
        configuration files.
       You could develop a web application at least ten times faster with Rails than you could with a
        typical Java framework.



Who is using Ruby on Rails?
   Twitter, Scribd,Yellowpages,ThoughtWorks,Amazon,Cisco,Oracle,IBM ... see the link
        http://www.workingwithrails.com/high-profile-organisations
Installing Ruby (Windows)
Download and Run the One-Click Installer from the following link:
http://www.ruby-lang.org/en/downloads/


                                 Installing Rails (Windows)
Option 1> GUI based Rails
You can download InstantRails, which has everything (Ruby, Rails, MySQL v4) in it.
http://instantrails.rubyforge.org/wiki/wiki.pl


Option 2 (Recommended)> However, If you already have Ruby and some kind of DB installed, and
want to use that for Rails. Just type the following command in console (Ensure ruby is in the PATH
var):
 gem install rails --include-dependencies
This will install the latest version of Rails


                      Integrated Development Environment
1. NetBeans offers great features to develop Ruby/Rails Applications.
                            http://www.netbeans.org/features/ruby/index.html
2. RadRails by Aptana is another very popular RoR IDE (free basic version)
                                       http://www.aptana.com/rails
3. Eclipse can also be used for RoR Development, but requires user to download a lot of packages.
The following article tells you, how to set up RoR Environment for Eclipse
                           http://www.napcs.com/howto/railsonwindows.html


Keeping Rails upto-date:
               gem update rails --include-dependencies
Rails Framework

RoR has a Model-View-Controller Architecture.
 Model: Model maintains the 'state' of the application. It’s an interface to the Database Tables. Active
Record is the Rails package, which provides the ORM Layer on top the Database tables. When,
working with RoR, one interacts with Model objects for Database transactions, which are translated
to Database tables seamlessly by the ORM layer (Active Record).
View: The View is responsible for generating the user interface, based on data from the Model or the
Controller.
Controller: Controllers receive events from the outside world (e.g. user input), interacts with the
Model, and displays an appropriate View to the user.
Action Pack is the Rails package that provides the library for View and Controller operations.



                    The following depicts the interactions in the MVC framework.
Creating a Sample Rails App:
       One of the biggest advantages of using RoR, is the speed at which one can get a jump-start on
a project, enabling the customer to get a glimpse of the end product, in the very early stages of the
development cycle.
1. To create a rails project, simply type the following command in your desired workspace
                                         rails <projectName>
 You will see that Rails automatically creates a hierarchy of folders and other important files for you,
essential for any general project.
For example: Say, We want to create a project called 'demo'
We type
C:rails_projects> rails demo
Now, go into the demo project root directory
C:rails_projects> cd demo
C:rails_projectsdemo>
You will find a directory structure as follows:
demo/
..../app
......../controller
......../helpers
......../models
......../views
............../layouts
..../components
..../config
..../db
..../doc
..../lib
..../log
..../public
..../script
..../test
..../tmp
..../vendor
README
Rakefile



Now, run the default web server that Rails ports with, by typing the command:
C:rails_projectsdemo> ruby script/server


                  You are done! Goto the following URL to access your application:
                                       http://localhost:3000
Rails will welcome you with the following screen:




                               Displaying 'Hello World!'
To write a simple Hello world app, we need just the controller and view code and not the model,
since we are not dealing with any DB yet.
So, create a controller called 'hello' by typing following command:
C:rails_projectsdemo>ruby script/generate controller hello
You will see that Rails automatically creates a HelloController in the controller folder, so open it in
your IDE and have a look at it. It will be like this:
       class HelloController < ApplicationController


       end
It’s an empty class that inherits from ApplicationController, so it gets all the default Controller
behavior from Rails. In order for the Controller to respond to user requests, we need to add 'action' to
it.
Let’s add an action called 'world', which any user can call to get some response.
class HelloController < ApplicationController
        def world
           end
end
Save it!
Now, go to the following URL
                                       http://localhost:3000/hello/world
The Rails URL follows a convention of domain/<ControllerName>/<ActionName>
But, you will get an error message, saying 'Template Missing', that is because the action does not
have an associated View, so Rails could not find it.
Note, that Each Controller will have a folder named after it in the Views folder.


So, go to the folder names 'hello' in the Views directory and create an html file called 'world.html'
Add some HTML code to display 'Hello World!' in it. Save it!


Now, again go to the same URL:
                                       http://localhost:3000/hello/world
Done! Rails now shall display your 'Hello World!' message




                           Recommended Books (Must Buy)
      1. Agile Web Development with Rails (By the creator of RoR)
      2. Programming Ruby


                                         Online Resources
      1. http://wiki.rubyonrails.com/rails
      2. http://www.railsbrain.com/
      3. http://www.ruby-doc.org/
      4. http://www.ruby-lang.org/en/
      5. http://api.rubyonrails.org/
      6. http://www.tutorialspoint.com/ruby-on-rails/index.htm

Mais conteúdo relacionado

Mais procurados

Projects In Laravel : Learn Laravel Building 10 Projects
Projects In Laravel : Learn Laravel Building 10 ProjectsProjects In Laravel : Learn Laravel Building 10 Projects
Projects In Laravel : Learn Laravel Building 10 ProjectsSam Dias
 
API Development with Laravel
API Development with LaravelAPI Development with Laravel
API Development with LaravelMichael Peacock
 
Laravel presentation
Laravel presentationLaravel presentation
Laravel presentationToufiq Mahmud
 
Building Application with Ruby On Rails Framework
Building Application with Ruby On Rails FrameworkBuilding Application with Ruby On Rails Framework
Building Application with Ruby On Rails FrameworkEdureka!
 
Introduction to laravel framework
Introduction to laravel frameworkIntroduction to laravel framework
Introduction to laravel frameworkAhmad Fatoni
 
Laravel - The PHP Framework for Web Artisans
Laravel - The PHP Framework for Web ArtisansLaravel - The PHP Framework for Web Artisans
Laravel - The PHP Framework for Web ArtisansWindzoon Technologies
 
Ruby on Rails workshop for beginner
Ruby on Rails workshop for beginnerRuby on Rails workshop for beginner
Ruby on Rails workshop for beginnerUmair Amjad
 
Laravel and CodeIgniter: pros & cons
Laravel and CodeIgniter: pros & consLaravel and CodeIgniter: pros & cons
Laravel and CodeIgniter: pros & consElenorWisozk
 
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 tutorialKaty Slemon
 
Asp .net web form fundamentals
Asp .net web form fundamentalsAsp .net web form fundamentals
Asp .net web form fundamentalsGopal Ji Singh
 
Ruby on Rails - An overview
Ruby on Rails -  An overviewRuby on Rails -  An overview
Ruby on Rails - An overviewThomas Asikis
 
Introduction to ASP.NET
Introduction to ASP.NETIntroduction to ASP.NET
Introduction to ASP.NETPeter Gfader
 
.net training | learn .net | Microsoft dot net Course | Microsoft dot net onl...
.net training | learn .net | Microsoft dot net Course | Microsoft dot net onl....net training | learn .net | Microsoft dot net Course | Microsoft dot net onl...
.net training | learn .net | Microsoft dot net Course | Microsoft dot net onl...Nancy Thomas
 
ASP.NET - Introduction to Web Forms and MVC
ASP.NET - Introduction to Web Forms and MVCASP.NET - Introduction to Web Forms and MVC
ASP.NET - Introduction to Web Forms and MVCBilal Amjad
 
Introduction to Ruby on Rails
Introduction to Ruby on RailsIntroduction to Ruby on Rails
Introduction to Ruby on RailsAgnieszka Figiel
 

Mais procurados (20)

Projects In Laravel : Learn Laravel Building 10 Projects
Projects In Laravel : Learn Laravel Building 10 ProjectsProjects In Laravel : Learn Laravel Building 10 Projects
Projects In Laravel : Learn Laravel Building 10 Projects
 
API Development with Laravel
API Development with LaravelAPI Development with Laravel
API Development with Laravel
 
Laravel presentation
Laravel presentationLaravel presentation
Laravel presentation
 
Building Application with Ruby On Rails Framework
Building Application with Ruby On Rails FrameworkBuilding Application with Ruby On Rails Framework
Building Application with Ruby On Rails Framework
 
Introduction to laravel framework
Introduction to laravel frameworkIntroduction to laravel framework
Introduction to laravel framework
 
Laravel - The PHP Framework for Web Artisans
Laravel - The PHP Framework for Web ArtisansLaravel - The PHP Framework for Web Artisans
Laravel - The PHP Framework for Web Artisans
 
Ruby on Rails workshop for beginner
Ruby on Rails workshop for beginnerRuby on Rails workshop for beginner
Ruby on Rails workshop for beginner
 
Laravel and CodeIgniter: pros & cons
Laravel and CodeIgniter: pros & consLaravel and CodeIgniter: pros & cons
Laravel and CodeIgniter: pros & cons
 
RubyonRails
RubyonRailsRubyonRails
RubyonRails
 
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
 
Asp .net web form fundamentals
Asp .net web form fundamentalsAsp .net web form fundamentals
Asp .net web form fundamentals
 
Ruby on Rails - An overview
Ruby on Rails -  An overviewRuby on Rails -  An overview
Ruby on Rails - An overview
 
Laravel 4 presentation
Laravel 4 presentationLaravel 4 presentation
Laravel 4 presentation
 
ASP.NET Web form
ASP.NET Web formASP.NET Web form
ASP.NET Web form
 
Introduction to ASP.NET
Introduction to ASP.NETIntroduction to ASP.NET
Introduction to ASP.NET
 
.net training | learn .net | Microsoft dot net Course | Microsoft dot net onl...
.net training | learn .net | Microsoft dot net Course | Microsoft dot net onl....net training | learn .net | Microsoft dot net Course | Microsoft dot net onl...
.net training | learn .net | Microsoft dot net Course | Microsoft dot net onl...
 
ASP.NET - Introduction to Web Forms and MVC
ASP.NET - Introduction to Web Forms and MVCASP.NET - Introduction to Web Forms and MVC
ASP.NET - Introduction to Web Forms and MVC
 
SEGAP - Technical overview
SEGAP - Technical overviewSEGAP - Technical overview
SEGAP - Technical overview
 
Introduction to Ruby on Rails
Introduction to Ruby on RailsIntroduction to Ruby on Rails
Introduction to Ruby on Rails
 
Web forms in ASP.net
Web forms in ASP.netWeb forms in ASP.net
Web forms in ASP.net
 

Destaque

Fresher 2015(ECE-72.57%)
Fresher 2015(ECE-72.57%)Fresher 2015(ECE-72.57%)
Fresher 2015(ECE-72.57%)Nandini T M
 
Universidad politécnica estatal del carchi,
Universidad politécnica estatal del carchi,Universidad politécnica estatal del carchi,
Universidad politécnica estatal del carchi,Valerie Dalin
 
The enemy of state : conclusion
The enemy of state : conclusionThe enemy of state : conclusion
The enemy of state : conclusionWillem Kuypers
 
Time Defiance
Time DefianceTime Defiance
Time DefianceLembol
 
Sub Part R cert
Sub Part R certSub Part R cert
Sub Part R certJim Greene
 
Stretegia Twojego Sukcesu
Stretegia Twojego SukcesuStretegia Twojego Sukcesu
Stretegia Twojego SukcesuLembol
 
A Gerencia da Vida
A Gerencia da VidaA Gerencia da Vida
A Gerencia da VidaAbraao Dahis
 
SAP Skillset
SAP SkillsetSAP Skillset
SAP SkillsetJing Wang
 
Детство в городе - проблемные вопросы
Детство в городе - проблемные вопросыДетство в городе - проблемные вопросы
Детство в городе - проблемные вопросыLAZOVOY
 
Cuestionariopara identificareltipodeinteligenciadepercepciondominante john ib...
Cuestionariopara identificareltipodeinteligenciadepercepciondominante john ib...Cuestionariopara identificareltipodeinteligenciadepercepciondominante john ib...
Cuestionariopara identificareltipodeinteligenciadepercepciondominante john ib...johniba
 

Destaque (14)

Fresher 2015(ECE-72.57%)
Fresher 2015(ECE-72.57%)Fresher 2015(ECE-72.57%)
Fresher 2015(ECE-72.57%)
 
Saranya resume
Saranya resumeSaranya resume
Saranya resume
 
Sanjeev rai
Sanjeev raiSanjeev rai
Sanjeev rai
 
Universidad politécnica estatal del carchi,
Universidad politécnica estatal del carchi,Universidad politécnica estatal del carchi,
Universidad politécnica estatal del carchi,
 
The enemy of state : conclusion
The enemy of state : conclusionThe enemy of state : conclusion
The enemy of state : conclusion
 
Time Defiance
Time DefianceTime Defiance
Time Defiance
 
Sub Part R cert
Sub Part R certSub Part R cert
Sub Part R cert
 
Diploma
DiplomaDiploma
Diploma
 
Stretegia Twojego Sukcesu
Stretegia Twojego SukcesuStretegia Twojego Sukcesu
Stretegia Twojego Sukcesu
 
A Gerencia da Vida
A Gerencia da VidaA Gerencia da Vida
A Gerencia da Vida
 
SAP Skillset
SAP SkillsetSAP Skillset
SAP Skillset
 
Apresentação
ApresentaçãoApresentação
Apresentação
 
Детство в городе - проблемные вопросы
Детство в городе - проблемные вопросыДетство в городе - проблемные вопросы
Детство в городе - проблемные вопросы
 
Cuestionariopara identificareltipodeinteligenciadepercepciondominante john ib...
Cuestionariopara identificareltipodeinteligenciadepercepciondominante john ib...Cuestionariopara identificareltipodeinteligenciadepercepciondominante john ib...
Cuestionariopara identificareltipodeinteligenciadepercepciondominante john ib...
 

Semelhante a Ruby On Rails

Viridians on Rails
Viridians on RailsViridians on Rails
Viridians on RailsViridians
 
Ruby On Rails Siddhesh
Ruby On Rails SiddheshRuby On Rails Siddhesh
Ruby On Rails SiddheshSiddhesh Bhobe
 
Ruby Rails Web Development
Ruby Rails Web DevelopmentRuby Rails Web Development
Ruby Rails Web DevelopmentSonia Simi
 
Instruments ruby on rails
Instruments ruby on railsInstruments ruby on rails
Instruments ruby on railspmashchak
 
Ruby on Rails introduction
Ruby on Rails introduction Ruby on Rails introduction
Ruby on Rails introduction Tran Hung
 
Introduction to Ruby on Rails
Introduction to Ruby on RailsIntroduction to Ruby on Rails
Introduction to Ruby on RailsAlessandro DS
 
A Tour of Ruby On Rails
A Tour of Ruby On RailsA Tour of Ruby On Rails
A Tour of Ruby On RailsDavid Keener
 
Ruby Rails Web Development.pdf
Ruby Rails Web Development.pdfRuby Rails Web Development.pdf
Ruby Rails Web Development.pdfAyesha Siddika
 
Building Application With Ruby On Rails Framework
Building Application With Ruby On Rails FrameworkBuilding Application With Ruby On Rails Framework
Building Application With Ruby On Rails FrameworkVineet Chaturvedi
 
Ruby On Rails Seminar Basis Softexpo Feb2010
Ruby On Rails Seminar Basis Softexpo Feb2010Ruby On Rails Seminar Basis Softexpo Feb2010
Ruby On Rails Seminar Basis Softexpo Feb2010arif44
 
Ruby On Rails Tutorial
Ruby On Rails TutorialRuby On Rails Tutorial
Ruby On Rails Tutorialsunniboy
 

Semelhante a Ruby On Rails (20)

Viridians on Rails
Viridians on RailsViridians on Rails
Viridians on Rails
 
Ruby On Rails Siddhesh
Ruby On Rails SiddheshRuby On Rails Siddhesh
Ruby On Rails Siddhesh
 
Ruby Rails Web Development
Ruby Rails Web DevelopmentRuby Rails Web Development
Ruby Rails Web Development
 
Instruments ruby on rails
Instruments ruby on railsInstruments ruby on rails
Instruments ruby on rails
 
Ruby Rails Web Development.pdf
Ruby Rails Web Development.pdfRuby Rails Web Development.pdf
Ruby Rails Web Development.pdf
 
Ruby on Rails introduction
Ruby on Rails introduction Ruby on Rails introduction
Ruby on Rails introduction
 
Introduction to Ruby on Rails
Introduction to Ruby on RailsIntroduction to Ruby on Rails
Introduction to Ruby on Rails
 
A Tour of Ruby On Rails
A Tour of Ruby On RailsA Tour of Ruby On Rails
A Tour of Ruby On Rails
 
Ruby on rails for beginers
Ruby on rails for beginersRuby on rails for beginers
Ruby on rails for beginers
 
Ruby Rails Web Development.pdf
Ruby Rails Web Development.pdfRuby Rails Web Development.pdf
Ruby Rails Web Development.pdf
 
Building Application With Ruby On Rails Framework
Building Application With Ruby On Rails FrameworkBuilding Application With Ruby On Rails Framework
Building Application With Ruby On Rails Framework
 
Rails Concept
Rails ConceptRails Concept
Rails Concept
 
Ruby On Rails Seminar Basis Softexpo Feb2010
Ruby On Rails Seminar Basis Softexpo Feb2010Ruby On Rails Seminar Basis Softexpo Feb2010
Ruby On Rails Seminar Basis Softexpo Feb2010
 
Ruby On Rails Tutorial
Ruby On Rails TutorialRuby On Rails Tutorial
Ruby On Rails Tutorial
 
RoR guide_p1
RoR guide_p1RoR guide_p1
RoR guide_p1
 
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
 
Supa fast Ruby + Rails
Supa fast Ruby + RailsSupa fast Ruby + Rails
Supa fast Ruby + Rails
 
FGCU Camp Talk
FGCU Camp TalkFGCU Camp Talk
FGCU Camp Talk
 

Último

Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodJuan lago vázquez
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businesspanagenda
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontologyjohnbeverley2021
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MIND CTI
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024The Digital Insurer
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...apidays
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Jeffrey Haguewood
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamUiPathCommunity
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Victor Rentea
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Orbitshub
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...apidays
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdfSandro Moreira
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Victor Rentea
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 

Último (20)

Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
 
Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 

Ruby On Rails

  • 1. Aniruddha S Deshpande Arlington,Texas, USA 1-817-714-7899 anides84@gmail.com Ruby on Rails Ruby on Rails is an extremely productive web application framework written in Ruby by David Heinemeier Hansson. This is a open source Ruby framework for developing database-backed web applications. Ruby on Rails has gained popularity in the enterprise development community among both programmers and system managers. As an open source platform, Ruby is proving to offer a number of advantages for powering enterprise applications, not the least of which is a shorter development time for robust applications and the creation of denser code that's easy to work with and maintain. What is Ruby?  A High Level Programming Language  Interpreted like Perl, Python  Object-Oriented like Java  Easy to learn.  Open source (very liberal license) Rich libraries  Very easy to extend  Less Coding with fewer bugs  Large and Helpful community What is Rails?  An extremely productive web-application framework.  Includes everything needed to create a database-driven web application using the Model- View-Controller pattern.  Requires fewer total lines of code than other frameworks spend setting up their XML configuration files.  You could develop a web application at least ten times faster with Rails than you could with a typical Java framework. Who is using Ruby on Rails? Twitter, Scribd,Yellowpages,ThoughtWorks,Amazon,Cisco,Oracle,IBM ... see the link http://www.workingwithrails.com/high-profile-organisations
  • 2. Installing Ruby (Windows) Download and Run the One-Click Installer from the following link: http://www.ruby-lang.org/en/downloads/ Installing Rails (Windows) Option 1> GUI based Rails You can download InstantRails, which has everything (Ruby, Rails, MySQL v4) in it. http://instantrails.rubyforge.org/wiki/wiki.pl Option 2 (Recommended)> However, If you already have Ruby and some kind of DB installed, and want to use that for Rails. Just type the following command in console (Ensure ruby is in the PATH var): gem install rails --include-dependencies This will install the latest version of Rails Integrated Development Environment 1. NetBeans offers great features to develop Ruby/Rails Applications. http://www.netbeans.org/features/ruby/index.html 2. RadRails by Aptana is another very popular RoR IDE (free basic version) http://www.aptana.com/rails 3. Eclipse can also be used for RoR Development, but requires user to download a lot of packages. The following article tells you, how to set up RoR Environment for Eclipse http://www.napcs.com/howto/railsonwindows.html Keeping Rails upto-date: gem update rails --include-dependencies
  • 3. Rails Framework RoR has a Model-View-Controller Architecture. Model: Model maintains the 'state' of the application. It’s an interface to the Database Tables. Active Record is the Rails package, which provides the ORM Layer on top the Database tables. When, working with RoR, one interacts with Model objects for Database transactions, which are translated to Database tables seamlessly by the ORM layer (Active Record). View: The View is responsible for generating the user interface, based on data from the Model or the Controller. Controller: Controllers receive events from the outside world (e.g. user input), interacts with the Model, and displays an appropriate View to the user. Action Pack is the Rails package that provides the library for View and Controller operations. The following depicts the interactions in the MVC framework.
  • 4. Creating a Sample Rails App: One of the biggest advantages of using RoR, is the speed at which one can get a jump-start on a project, enabling the customer to get a glimpse of the end product, in the very early stages of the development cycle. 1. To create a rails project, simply type the following command in your desired workspace rails <projectName> You will see that Rails automatically creates a hierarchy of folders and other important files for you, essential for any general project. For example: Say, We want to create a project called 'demo' We type C:rails_projects> rails demo Now, go into the demo project root directory C:rails_projects> cd demo C:rails_projectsdemo> You will find a directory structure as follows: demo/ ..../app ......../controller ......../helpers ......../models ......../views ............../layouts ..../components ..../config ..../db ..../doc ..../lib ..../log ..../public ..../script ..../test ..../tmp ..../vendor README Rakefile Now, run the default web server that Rails ports with, by typing the command: C:rails_projectsdemo> ruby script/server You are done! Goto the following URL to access your application: http://localhost:3000
  • 5. Rails will welcome you with the following screen: Displaying 'Hello World!' To write a simple Hello world app, we need just the controller and view code and not the model, since we are not dealing with any DB yet. So, create a controller called 'hello' by typing following command: C:rails_projectsdemo>ruby script/generate controller hello You will see that Rails automatically creates a HelloController in the controller folder, so open it in your IDE and have a look at it. It will be like this: class HelloController < ApplicationController end It’s an empty class that inherits from ApplicationController, so it gets all the default Controller behavior from Rails. In order for the Controller to respond to user requests, we need to add 'action' to it. Let’s add an action called 'world', which any user can call to get some response.
  • 6. class HelloController < ApplicationController def world end end Save it! Now, go to the following URL http://localhost:3000/hello/world The Rails URL follows a convention of domain/<ControllerName>/<ActionName> But, you will get an error message, saying 'Template Missing', that is because the action does not have an associated View, so Rails could not find it. Note, that Each Controller will have a folder named after it in the Views folder. So, go to the folder names 'hello' in the Views directory and create an html file called 'world.html' Add some HTML code to display 'Hello World!' in it. Save it! Now, again go to the same URL: http://localhost:3000/hello/world Done! Rails now shall display your 'Hello World!' message Recommended Books (Must Buy) 1. Agile Web Development with Rails (By the creator of RoR) 2. Programming Ruby Online Resources 1. http://wiki.rubyonrails.com/rails 2. http://www.railsbrain.com/ 3. http://www.ruby-doc.org/ 4. http://www.ruby-lang.org/en/ 5. http://api.rubyonrails.org/ 6. http://www.tutorialspoint.com/ruby-on-rails/index.htm