SlideShare a Scribd company logo
www.edureka.co/ruby-on-rails
View Ruby On Rails course details at http://www.edureka.co/ruby-on-rails
For Queries:
Post on Twitter @edurekaIN: #askEdureka
Post on Facebook /edurekaIN
For more details please contact us:
US : 1800 275 9730 (toll free)
INDIA : +91 88808 62004
Email us : sales@edureka.co
Building Application With Ruby On Rails
Framework
Slide 2 www.edureka.co/ruby-on-rails
Objectives
At the end of this module, you will be able to understand:
Introduction to Ruby on Rails Framework
Features of Ruby on Rails
MVC Architecture
Building Rails Application
Slide 3 www.edureka.co/ruby-on-rails
9 Reasons Why You Should Learn Ruby
It is easy to learn Saves time by writing more with less Create web apps quickly and with ease
It is free of charge Ruby can be customized
Slide 4 www.edureka.co/ruby-on-rails
9 Reasons Why You Should Learn Ruby (Contd.)
It is Portable Learning Ruby helps you get a job
Make your own Domain Specific Language The community will help
DSL
Slide 5Slide 5Slide 5 www.edureka.co/ruby-on-rails
History
 Ruby released in 1993
 It was designed by Yukihiro Matsumoto.
 It’s mainly influenced by the predecessors Perl, Smalltalk, Eiffel, Ada and Lisp
Slide 6Slide 6Slide 6 www.edureka.co/ruby-on-rails
Ruby – An Overview
 Ruby is an Object Oriented Programming language
 It is an interpreted language
 Ruby draws from Smalltalk, Perl and Lisp
 It treats everything as an object
 Ruby has simple English like syntax
 Using Ruby you will write less code
Slide 7Slide 7Slide 7 www.edureka.co/ruby-on-rails
Ruby on Rails
 Ruby on Rails is a full-stack framework
» Used to developing web applications
» It is working under the Model-View-Control pattern
» It is an open source framework
 Ruby on Rails framework is familiar for
» Simplicity
» Productivity
» Speed of development
» Reliable Solutions
Slide 8Slide 8Slide 8 www.edureka.co/ruby-on-rails
Ruby on Rails – Reason behind the name
 Ruby is the programming language used to implement the framework
 The entire Rails Framework is written in Ruby
 Rails is the framework that gives the necessary infrastructure
 Ruby provides Simple Syntax and Productive coding
 Ruby on Rails lets you write efficient web application using convention over configuration
Slide 9 www.edureka.co/ruby-on-rails
Ruby 1.0
Dec,
1996
Ruby 1.2
Dec ,
1997
Ruby 1.4
Aug ,
1999
Ruby 1.6
Ruby 1.8
Sept ,
2000
Aug, 2003
Ruby 1.9
Dec,
2007
Ruby 2.0
Feb ,
2013
Ruby 2.1
Dec,
2013
Ruby Versions
Ruby 2.2
Apr,
2015
We will be using Ruby 2.1.6 in
this course.
Slide 10 www.edureka.co/ruby-on-rails
 Ruby is a popular language in the league of Python, Perl, PHP
 Ruby is Object-Oriented in the purest sense and has flexible Object model than any other languages
 Its is available on Windows/Mac/Linux
 Learning Ruby helps to work on Ruby on Rails, an open source web application framework that is used to
create web applications
 It also has a dynamic type system and automatic memory management
Advantages
Slide 11Slide 11Slide 11 www.edureka.co/ruby-on-rails
Examples of Application built on Ruby on Rails
Slide 12Slide 12Slide 12 www.edureka.co/ruby-on-rails
Rails Golden Rules
 Convention over configuration(COC)
» COC means that the developer should only be specifying unconventional aspects of the application.
Ruby on Rails conventions guides you to less code and less repetition
 Don’t Repeat Yourself (DRY)
» DRY means that information can be found in a single and common location, where the developer can
reuse the code
Slide 13Slide 13Slide 13 www.edureka.co/ruby-on-rails
Rails Architecture
Rails applications are implemented using the Model-View-Controller (MVC)
 Model will be denoted as ActiveRecord
» Back end Database and Tables will be handled by ActiveRecord
 View will be denoted as ActionView
» HTML and Front end tools will be handled by ActionView
 Controller will be denoted as ActionController
» Request and responses will be handled by ActionController
Slide 14Slide 14Slide 14 www.edureka.co/ruby-on-rails
MVC Architecture
Slide 15Slide 15Slide 15 http://www.edureka.co/ruby-on-rails
 Rails application can be created using the following command
>rails new app_name
 When you create an application using the rails helper script, you can see that a new directly structure is
created for your application. The directory structure will have to following directories that will be explained in
the next slide.
Creating a Rails Application
Slide 16Slide 16Slide 16 http://www.edureka.co/ruby-on-rails
Directory Layout
File /Folder Purpose
app/
Contains the controllers, models, views, helpers, mailers and assets for your
application.
bin/
Contains the rails script that starts your app and can contain other scripts you use to
deploy or run your application.
config/ Configure your application's routes, database, and more
condig.ru Rack configuration for Rack based servers used to start the application.
db/ Contains your current database schema, as well as the database migrations
Gemfile
Gemfile.lock
These files allow you to specify what gem dependencies are needed for your Rails
application. These files are used by the Bundler gem.
Lib/ Extended modules for you application
Log/ Application log files
Slide 17Slide 17Slide 17 http://www.edureka.co/ruby-on-rails
Directory Layout (Contd.)
File /Folder Purpose
public/ The only folder seen by the world as-is. Contains static files and compiled assets.
Rakefile
This file locates and loads tasks that can be run from the command line. Rather than
changing Rakefile, you should add your own tasks by adding files to the lib/tasks
directory of your application
README.rdoc
This is a brief instruction manual for your application. You should edit this file to tell
others what your application does, how to set it up, and so on.
test/ Unit tests, fixtures, and other test apparatus.
tmp/ Temporary files (like cache, pid, and session files).
Vendor/
A place for all third-party code. In a typical Rails application this includes vendor’s
gems.
Slide 18Slide 18Slide 18 http://www.edureka.co/ruby-on-rails
 Rails application can be booted using the
following command
>rails server
 This command will fire up WEBrick, a web
server distributed with Ruby.
» Default environment is development
» Default port is 3000
» http://127.0.0.1:3000
Running Rails Application
Slide 19Slide 19Slide 19 http://www.edureka.co/ruby-on-rails
To see your application in action, open a browser window and navigate to http://localhost:3000
Running Rails Application (Contd.)
Slide 20Slide 20Slide 20 http://www.edureka.co/ruby-on-rails
Creating Rails Views and Controller
 Create first controller
>rails generate controller home
 Create new file and store with name index.html.erb
>rails g controller home index
 Add the content to index.html.erb file
<h1>Hello, Rails!</h1>
 Open the file config/routes.rb in your editor. Remove
the comment “#” and change root to
# root ‘home#index'
Slide 21Slide 21Slide 21 http://www.edureka.co/ruby-on-rails
Creating Rails Views and Controller (Contd.)
Launch the web server again and navigate to http://localhost:3000 in your browser.
Slide 22 www.edureka.co/ruby-on-rails
Questions
For Queries:
Post on Twitter @edurekaIN: #askEdureka
Post on Facebook /edurekaIN
Slide 23 www.edureka.co/ruby-on-rails
Ad

Recommended

Week 3 - Interactive News Editing and Producing
Week 3 - Interactive News Editing and Producing
kurtgessler
 
Virtual information centers teldan 5 2011
Virtual information centers teldan 5 2011
Inbar Yasur ענבר יסעור
 
Information update sept 2011
Information update sept 2011
Inbar Yasur ענבר יסעור
 
Web 2.0: What Can It Offer The Research Community?
Web 2.0: What Can It Offer The Research Community?
lisbk
 
Lecture7
Lecture7
guest8461ae
 
Facebook plateform architecture presentation
Facebook plateform architecture presentation
Inam Soomro
 
Reduce Side Joins
Reduce Side Joins
Edureka!
 
Getting Started With AngularJS
Getting Started With AngularJS
Edureka!
 
Building Application with Ruby On Rails Framework
Building Application with Ruby On Rails Framework
Edureka!
 
Principles of MVC for Rails Developers
Principles of MVC for Rails Developers
Edureka!
 
Aspose pdf
Aspose pdf
Jim Jones
 
Ruby Rails Web Development
Ruby Rails Web Development
Sonia Simi
 
The Birth and Evolution of Ruby on Rails
The Birth and Evolution of Ruby on Rails
company
 
Ruby On Rails Seminar Basis Softexpo Feb2010
Ruby On Rails Seminar Basis Softexpo Feb2010
arif44
 
Ruby Rails Web Development.pdf
Ruby Rails Web Development.pdf
SEO expate Bangladesh Ltd
 
A Tour of Ruby On Rails
A Tour of Ruby On Rails
David Keener
 
Make your app idea a reality with Ruby On Rails
Make your app idea a reality with Ruby On Rails
Nataly Tkachuk
 
Introduction To Rails
Introduction To Rails
Eric Gruber
 
RoR (Ruby on Rails)
RoR (Ruby on Rails)
scandiweb
 
Lecture #5 Introduction to rails
Lecture #5 Introduction to rails
Evgeniy Hinyuk
 
Introduction to Rails by Evgeniy Hinyuk
Introduction to Rails by Evgeniy Hinyuk
Pivorak MeetUp
 
Ruby On Rails
Ruby On Rails
anides
 
Real World Rails 5 Programming for Web Developers
Real World Rails 5 Programming for Web Developers
prshant navgrha
 
Why Use Ruby On Rails.pdf
Why Use Ruby On Rails.pdf
Katy Slemon
 
Ruby vs Ruby on Rails: Find Out The Differences - RORBits
Ruby vs Ruby on Rails: Find Out The Differences - RORBits
rorbitssoftware
 
Ruby On Rails
Ruby On Rails
iradarji
 
Rubyonrails 120409061835-phpapp02
Rubyonrails 120409061835-phpapp02
sagaroceanic11
 
Ruby On Rails Basics
Ruby On Rails Basics
Amit Solanki
 
AI VIDEO MAGAZINE - June 2025 - r/aivideo
AI VIDEO MAGAZINE - June 2025 - r/aivideo
1pcity Studios, Inc
 
Security Tips for Enterprise Azure Solutions
Security Tips for Enterprise Azure Solutions
Michele Leroux Bustamante
 

More Related Content

Similar to Building Application With Ruby On Rails Framework (20)

Building Application with Ruby On Rails Framework
Building Application with Ruby On Rails Framework
Edureka!
 
Principles of MVC for Rails Developers
Principles of MVC for Rails Developers
Edureka!
 
Aspose pdf
Aspose pdf
Jim Jones
 
Ruby Rails Web Development
Ruby Rails Web Development
Sonia Simi
 
The Birth and Evolution of Ruby on Rails
The Birth and Evolution of Ruby on Rails
company
 
Ruby On Rails Seminar Basis Softexpo Feb2010
Ruby On Rails Seminar Basis Softexpo Feb2010
arif44
 
Ruby Rails Web Development.pdf
Ruby Rails Web Development.pdf
SEO expate Bangladesh Ltd
 
A Tour of Ruby On Rails
A Tour of Ruby On Rails
David Keener
 
Make your app idea a reality with Ruby On Rails
Make your app idea a reality with Ruby On Rails
Nataly Tkachuk
 
Introduction To Rails
Introduction To Rails
Eric Gruber
 
RoR (Ruby on Rails)
RoR (Ruby on Rails)
scandiweb
 
Lecture #5 Introduction to rails
Lecture #5 Introduction to rails
Evgeniy Hinyuk
 
Introduction to Rails by Evgeniy Hinyuk
Introduction to Rails by Evgeniy Hinyuk
Pivorak MeetUp
 
Ruby On Rails
Ruby On Rails
anides
 
Real World Rails 5 Programming for Web Developers
Real World Rails 5 Programming for Web Developers
prshant navgrha
 
Why Use Ruby On Rails.pdf
Why Use Ruby On Rails.pdf
Katy Slemon
 
Ruby vs Ruby on Rails: Find Out The Differences - RORBits
Ruby vs Ruby on Rails: Find Out The Differences - RORBits
rorbitssoftware
 
Ruby On Rails
Ruby On Rails
iradarji
 
Rubyonrails 120409061835-phpapp02
Rubyonrails 120409061835-phpapp02
sagaroceanic11
 
Ruby On Rails Basics
Ruby On Rails Basics
Amit Solanki
 
Building Application with Ruby On Rails Framework
Building Application with Ruby On Rails Framework
Edureka!
 
Principles of MVC for Rails Developers
Principles of MVC for Rails Developers
Edureka!
 
Ruby Rails Web Development
Ruby Rails Web Development
Sonia Simi
 
The Birth and Evolution of Ruby on Rails
The Birth and Evolution of Ruby on Rails
company
 
Ruby On Rails Seminar Basis Softexpo Feb2010
Ruby On Rails Seminar Basis Softexpo Feb2010
arif44
 
A Tour of Ruby On Rails
A Tour of Ruby On Rails
David Keener
 
Make your app idea a reality with Ruby On Rails
Make your app idea a reality with Ruby On Rails
Nataly Tkachuk
 
Introduction To Rails
Introduction To Rails
Eric Gruber
 
RoR (Ruby on Rails)
RoR (Ruby on Rails)
scandiweb
 
Lecture #5 Introduction to rails
Lecture #5 Introduction to rails
Evgeniy Hinyuk
 
Introduction to Rails by Evgeniy Hinyuk
Introduction to Rails by Evgeniy Hinyuk
Pivorak MeetUp
 
Ruby On Rails
Ruby On Rails
anides
 
Real World Rails 5 Programming for Web Developers
Real World Rails 5 Programming for Web Developers
prshant navgrha
 
Why Use Ruby On Rails.pdf
Why Use Ruby On Rails.pdf
Katy Slemon
 
Ruby vs Ruby on Rails: Find Out The Differences - RORBits
Ruby vs Ruby on Rails: Find Out The Differences - RORBits
rorbitssoftware
 
Ruby On Rails
Ruby On Rails
iradarji
 
Rubyonrails 120409061835-phpapp02
Rubyonrails 120409061835-phpapp02
sagaroceanic11
 
Ruby On Rails Basics
Ruby On Rails Basics
Amit Solanki
 

Recently uploaded (20)

AI VIDEO MAGAZINE - June 2025 - r/aivideo
AI VIDEO MAGAZINE - June 2025 - r/aivideo
1pcity Studios, Inc
 
Security Tips for Enterprise Azure Solutions
Security Tips for Enterprise Azure Solutions
Michele Leroux Bustamante
 
Using the SQLExecutor for Data Quality Management: aka One man's love for the...
Using the SQLExecutor for Data Quality Management: aka One man's love for the...
Safe Software
 
The Future of Product Management in AI ERA.pdf
The Future of Product Management in AI ERA.pdf
Alyona Owens
 
Enhance GitHub Copilot using MCP - Enterprise version.pdf
Enhance GitHub Copilot using MCP - Enterprise version.pdf
Nilesh Gule
 
Python Conference Singapore - 19 Jun 2025
Python Conference Singapore - 19 Jun 2025
ninefyi
 
Salesforce Summer '25 Release Frenchgathering.pptx.pdf
Salesforce Summer '25 Release Frenchgathering.pptx.pdf
yosra Saidani
 
Oh, the Possibilities - Balancing Innovation and Risk with Generative AI.pdf
Oh, the Possibilities - Balancing Innovation and Risk with Generative AI.pdf
Priyanka Aash
 
10 Key Challenges for AI within the EU Data Protection Framework.pdf
10 Key Challenges for AI within the EU Data Protection Framework.pdf
Priyanka Aash
 
MuleSoft for AgentForce : Topic Center and API Catalog
MuleSoft for AgentForce : Topic Center and API Catalog
shyamraj55
 
"How to survive Black Friday: preparing e-commerce for a peak season", Yurii ...
"How to survive Black Friday: preparing e-commerce for a peak season", Yurii ...
Fwdays
 
UserCon Belgium: Honey, VMware increased my bill
UserCon Belgium: Honey, VMware increased my bill
stijn40
 
AI vs Human Writing: Can You Tell the Difference?
AI vs Human Writing: Can You Tell the Difference?
Shashi Sathyanarayana, Ph.D
 
CapCut Pro Crack For PC Latest Version {Fully Unlocked} 2025
CapCut Pro Crack For PC Latest Version {Fully Unlocked} 2025
pcprocore
 
The Future of Technology: 2025-2125 by Saikat Basu.pdf
The Future of Technology: 2025-2125 by Saikat Basu.pdf
Saikat Basu
 
Cluster-Based Multi-Objective Metamorphic Test Case Pair Selection for Deep N...
Cluster-Based Multi-Objective Metamorphic Test Case Pair Selection for Deep N...
janeliewang985
 
ReSTIR [DI]: Spatiotemporal reservoir resampling for real-time ray tracing ...
ReSTIR [DI]: Spatiotemporal reservoir resampling for real-time ray tracing ...
revolcs10
 
EIS-Webinar-Engineering-Retail-Infrastructure-06-16-2025.pdf
EIS-Webinar-Engineering-Retail-Infrastructure-06-16-2025.pdf
Earley Information Science
 
cnc-processing-centers-centateq-p-110-en.pdf
cnc-processing-centers-centateq-p-110-en.pdf
AmirStern2
 
You are not excused! How to avoid security blind spots on the way to production
You are not excused! How to avoid security blind spots on the way to production
Michele Leroux Bustamante
 
AI VIDEO MAGAZINE - June 2025 - r/aivideo
AI VIDEO MAGAZINE - June 2025 - r/aivideo
1pcity Studios, Inc
 
Security Tips for Enterprise Azure Solutions
Security Tips for Enterprise Azure Solutions
Michele Leroux Bustamante
 
Using the SQLExecutor for Data Quality Management: aka One man's love for the...
Using the SQLExecutor for Data Quality Management: aka One man's love for the...
Safe Software
 
The Future of Product Management in AI ERA.pdf
The Future of Product Management in AI ERA.pdf
Alyona Owens
 
Enhance GitHub Copilot using MCP - Enterprise version.pdf
Enhance GitHub Copilot using MCP - Enterprise version.pdf
Nilesh Gule
 
Python Conference Singapore - 19 Jun 2025
Python Conference Singapore - 19 Jun 2025
ninefyi
 
Salesforce Summer '25 Release Frenchgathering.pptx.pdf
Salesforce Summer '25 Release Frenchgathering.pptx.pdf
yosra Saidani
 
Oh, the Possibilities - Balancing Innovation and Risk with Generative AI.pdf
Oh, the Possibilities - Balancing Innovation and Risk with Generative AI.pdf
Priyanka Aash
 
10 Key Challenges for AI within the EU Data Protection Framework.pdf
10 Key Challenges for AI within the EU Data Protection Framework.pdf
Priyanka Aash
 
MuleSoft for AgentForce : Topic Center and API Catalog
MuleSoft for AgentForce : Topic Center and API Catalog
shyamraj55
 
"How to survive Black Friday: preparing e-commerce for a peak season", Yurii ...
"How to survive Black Friday: preparing e-commerce for a peak season", Yurii ...
Fwdays
 
UserCon Belgium: Honey, VMware increased my bill
UserCon Belgium: Honey, VMware increased my bill
stijn40
 
AI vs Human Writing: Can You Tell the Difference?
AI vs Human Writing: Can You Tell the Difference?
Shashi Sathyanarayana, Ph.D
 
CapCut Pro Crack For PC Latest Version {Fully Unlocked} 2025
CapCut Pro Crack For PC Latest Version {Fully Unlocked} 2025
pcprocore
 
The Future of Technology: 2025-2125 by Saikat Basu.pdf
The Future of Technology: 2025-2125 by Saikat Basu.pdf
Saikat Basu
 
Cluster-Based Multi-Objective Metamorphic Test Case Pair Selection for Deep N...
Cluster-Based Multi-Objective Metamorphic Test Case Pair Selection for Deep N...
janeliewang985
 
ReSTIR [DI]: Spatiotemporal reservoir resampling for real-time ray tracing ...
ReSTIR [DI]: Spatiotemporal reservoir resampling for real-time ray tracing ...
revolcs10
 
EIS-Webinar-Engineering-Retail-Infrastructure-06-16-2025.pdf
EIS-Webinar-Engineering-Retail-Infrastructure-06-16-2025.pdf
Earley Information Science
 
cnc-processing-centers-centateq-p-110-en.pdf
cnc-processing-centers-centateq-p-110-en.pdf
AmirStern2
 
You are not excused! How to avoid security blind spots on the way to production
You are not excused! How to avoid security blind spots on the way to production
Michele Leroux Bustamante
 
Ad

Building Application With Ruby On Rails Framework

  • 1. www.edureka.co/ruby-on-rails View Ruby On Rails course details at http://www.edureka.co/ruby-on-rails For Queries: Post on Twitter @edurekaIN: #askEdureka Post on Facebook /edurekaIN For more details please contact us: US : 1800 275 9730 (toll free) INDIA : +91 88808 62004 Email us : [email protected] Building Application With Ruby On Rails Framework
  • 2. Slide 2 www.edureka.co/ruby-on-rails Objectives At the end of this module, you will be able to understand: Introduction to Ruby on Rails Framework Features of Ruby on Rails MVC Architecture Building Rails Application
  • 3. Slide 3 www.edureka.co/ruby-on-rails 9 Reasons Why You Should Learn Ruby It is easy to learn Saves time by writing more with less Create web apps quickly and with ease It is free of charge Ruby can be customized
  • 4. Slide 4 www.edureka.co/ruby-on-rails 9 Reasons Why You Should Learn Ruby (Contd.) It is Portable Learning Ruby helps you get a job Make your own Domain Specific Language The community will help DSL
  • 5. Slide 5Slide 5Slide 5 www.edureka.co/ruby-on-rails History  Ruby released in 1993  It was designed by Yukihiro Matsumoto.  It’s mainly influenced by the predecessors Perl, Smalltalk, Eiffel, Ada and Lisp
  • 6. Slide 6Slide 6Slide 6 www.edureka.co/ruby-on-rails Ruby – An Overview  Ruby is an Object Oriented Programming language  It is an interpreted language  Ruby draws from Smalltalk, Perl and Lisp  It treats everything as an object  Ruby has simple English like syntax  Using Ruby you will write less code
  • 7. Slide 7Slide 7Slide 7 www.edureka.co/ruby-on-rails Ruby on Rails  Ruby on Rails is a full-stack framework » Used to developing web applications » It is working under the Model-View-Control pattern » It is an open source framework  Ruby on Rails framework is familiar for » Simplicity » Productivity » Speed of development » Reliable Solutions
  • 8. Slide 8Slide 8Slide 8 www.edureka.co/ruby-on-rails Ruby on Rails – Reason behind the name  Ruby is the programming language used to implement the framework  The entire Rails Framework is written in Ruby  Rails is the framework that gives the necessary infrastructure  Ruby provides Simple Syntax and Productive coding  Ruby on Rails lets you write efficient web application using convention over configuration
  • 9. Slide 9 www.edureka.co/ruby-on-rails Ruby 1.0 Dec, 1996 Ruby 1.2 Dec , 1997 Ruby 1.4 Aug , 1999 Ruby 1.6 Ruby 1.8 Sept , 2000 Aug, 2003 Ruby 1.9 Dec, 2007 Ruby 2.0 Feb , 2013 Ruby 2.1 Dec, 2013 Ruby Versions Ruby 2.2 Apr, 2015 We will be using Ruby 2.1.6 in this course.
  • 10. Slide 10 www.edureka.co/ruby-on-rails  Ruby is a popular language in the league of Python, Perl, PHP  Ruby is Object-Oriented in the purest sense and has flexible Object model than any other languages  Its is available on Windows/Mac/Linux  Learning Ruby helps to work on Ruby on Rails, an open source web application framework that is used to create web applications  It also has a dynamic type system and automatic memory management Advantages
  • 11. Slide 11Slide 11Slide 11 www.edureka.co/ruby-on-rails Examples of Application built on Ruby on Rails
  • 12. Slide 12Slide 12Slide 12 www.edureka.co/ruby-on-rails Rails Golden Rules  Convention over configuration(COC) » COC means that the developer should only be specifying unconventional aspects of the application. Ruby on Rails conventions guides you to less code and less repetition  Don’t Repeat Yourself (DRY) » DRY means that information can be found in a single and common location, where the developer can reuse the code
  • 13. Slide 13Slide 13Slide 13 www.edureka.co/ruby-on-rails Rails Architecture Rails applications are implemented using the Model-View-Controller (MVC)  Model will be denoted as ActiveRecord » Back end Database and Tables will be handled by ActiveRecord  View will be denoted as ActionView » HTML and Front end tools will be handled by ActionView  Controller will be denoted as ActionController » Request and responses will be handled by ActionController
  • 14. Slide 14Slide 14Slide 14 www.edureka.co/ruby-on-rails MVC Architecture
  • 15. Slide 15Slide 15Slide 15 http://www.edureka.co/ruby-on-rails  Rails application can be created using the following command >rails new app_name  When you create an application using the rails helper script, you can see that a new directly structure is created for your application. The directory structure will have to following directories that will be explained in the next slide. Creating a Rails Application
  • 16. Slide 16Slide 16Slide 16 http://www.edureka.co/ruby-on-rails Directory Layout File /Folder Purpose app/ Contains the controllers, models, views, helpers, mailers and assets for your application. bin/ Contains the rails script that starts your app and can contain other scripts you use to deploy or run your application. config/ Configure your application's routes, database, and more condig.ru Rack configuration for Rack based servers used to start the application. db/ Contains your current database schema, as well as the database migrations Gemfile Gemfile.lock These files allow you to specify what gem dependencies are needed for your Rails application. These files are used by the Bundler gem. Lib/ Extended modules for you application Log/ Application log files
  • 17. Slide 17Slide 17Slide 17 http://www.edureka.co/ruby-on-rails Directory Layout (Contd.) File /Folder Purpose public/ The only folder seen by the world as-is. Contains static files and compiled assets. Rakefile This file locates and loads tasks that can be run from the command line. Rather than changing Rakefile, you should add your own tasks by adding files to the lib/tasks directory of your application README.rdoc This is a brief instruction manual for your application. You should edit this file to tell others what your application does, how to set it up, and so on. test/ Unit tests, fixtures, and other test apparatus. tmp/ Temporary files (like cache, pid, and session files). Vendor/ A place for all third-party code. In a typical Rails application this includes vendor’s gems.
  • 18. Slide 18Slide 18Slide 18 http://www.edureka.co/ruby-on-rails  Rails application can be booted using the following command >rails server  This command will fire up WEBrick, a web server distributed with Ruby. » Default environment is development » Default port is 3000 » http://127.0.0.1:3000 Running Rails Application
  • 19. Slide 19Slide 19Slide 19 http://www.edureka.co/ruby-on-rails To see your application in action, open a browser window and navigate to http://localhost:3000 Running Rails Application (Contd.)
  • 20. Slide 20Slide 20Slide 20 http://www.edureka.co/ruby-on-rails Creating Rails Views and Controller  Create first controller >rails generate controller home  Create new file and store with name index.html.erb >rails g controller home index  Add the content to index.html.erb file <h1>Hello, Rails!</h1>  Open the file config/routes.rb in your editor. Remove the comment “#” and change root to # root ‘home#index'
  • 21. Slide 21Slide 21Slide 21 http://www.edureka.co/ruby-on-rails Creating Rails Views and Controller (Contd.) Launch the web server again and navigate to http://localhost:3000 in your browser.
  • 22. Slide 22 www.edureka.co/ruby-on-rails Questions For Queries: Post on Twitter @edurekaIN: #askEdureka Post on Facebook /edurekaIN