SlideShare a Scribd company logo
1 of 4
Download to read offline
Web Application Architectures
Module 5: Middleware
Lecture 8: MVC Implementation in Rails
c 2011-13 G.L. Heileman Module 5, Lecture 8 1 / 4
Ruby on Rails
In Rails, the following classes support the MVC design pattern:
Model – The ActiveRecord class, described previously, implements
object-relational mappings (ORM).
View – Views and controllers are actually bundled together in Rails in
Action Pack. Dynamic content is generated by templates containing
embedded Ruby (ERb) code supported by the ActionView class.
Controller – The ActionController class is the core of a web request in
Rails. It consists of one or more actions that are executed on request
and then either render a template or redirect to another action. An
action is defined as a public method on the controller, which will
automatically be made accessible to the web-server through Rails
Routes.
c 2011-13 G.L. Heileman Module 5, Lecture 8 2 / 4
MVC Interactions in Rails
1 The browser sends a request to the web server.
1 The browser sends a request to the web server.
2 The web server processes the request, determines which route it
belongs to and dispatches that request to the corresponding controller
method.
1 The browser sends a request to the web server.
2 The web server processes the request, determines which route it
belongs to and dispatches that request to the corresponding controller
method.
3 The controller asks the model layer for all of the information needed
to complete the request.
1 The browser sends a request to the web server.
2 The web server processes the request, determines which route it
belongs to and dispatches that request to the corresponding controller
method.
3 The controller asks the model layer for all of the information neededc 2011-13 G.L. Heileman Module 5, Lecture 8 3 / 4
MVC Interactions in Rails
Browser
Web Server
Routes
Dispatcher
Controller
Model View
1
2
http://localhost:3000/posts
PostsController::index
3 @posts = Post.all 5 @posts
4 Post array
8 text/html
6 index.html.erb
resources :posts
7 application.html.erb
+ index.html
(response)(GET request)
c 2011-13 G.L. Heileman Module 5, Lecture 8 4 / 4

More Related Content

What's hot

Create Account in Salesforce using Mule ESB
Create Account in Salesforce using Mule ESBCreate Account in Salesforce using Mule ESB
Create Account in Salesforce using Mule ESBSanjeet Pandey
 
Scatter gather in mule
Scatter gather in muleScatter gather in mule
Scatter gather in muleKhasim Cise
 
SOAP To REST API Proxy
SOAP To REST API ProxySOAP To REST API Proxy
SOAP To REST API ProxyVince Soliza
 
S E R V L E T S
S E R V L E T SS E R V L E T S
S E R V L E T Spatinijava
 
Java Basics
Java BasicsJava Basics
Java BasicsKhan625
 
Mulesoft Calling Flow of Other Applications
Mulesoft Calling Flow of Other ApplicationsMulesoft Calling Flow of Other Applications
Mulesoft Calling Flow of Other Applicationskumar gaurav
 
Integration with Sercice-Now using Mule ESB
Integration with Sercice-Now using Mule ESBIntegration with Sercice-Now using Mule ESB
Integration with Sercice-Now using Mule ESBSanjeet Pandey
 
Building Reactive webapp with React/Flux
Building Reactive webapp with React/FluxBuilding Reactive webapp with React/Flux
Building Reactive webapp with React/FluxKeuller Magalhães
 
Mule Microsoft Share Point 2010 Connector
Mule Microsoft Share Point 2010 ConnectorMule Microsoft Share Point 2010 Connector
Mule Microsoft Share Point 2010 ConnectorAnkush Sharma
 
Using mule with web services
Using mule with web servicesUsing mule with web services
Using mule with web servicesShanky Gupta
 
Making design decisions in React-based ClojureScript web applications
Making design decisions in React-based ClojureScript web applicationsMaking design decisions in React-based ClojureScript web applications
Making design decisions in React-based ClojureScript web applicationsFalko Riemenschneider
 
Active mq read and write flow in mule
Active mq  read and write flow in muleActive mq  read and write flow in mule
Active mq read and write flow in muleAnkit Lawaniya
 
Scatter and gather in mule
Scatter and gather in muleScatter and gather in mule
Scatter and gather in muleRajkattamuri
 

What's hot (20)

Create Account in Salesforce using Mule ESB
Create Account in Salesforce using Mule ESBCreate Account in Salesforce using Mule ESB
Create Account in Salesforce using Mule ESB
 
Scatter gather in mule
Scatter gather in muleScatter gather in mule
Scatter gather in mule
 
SOAP To REST API Proxy
SOAP To REST API ProxySOAP To REST API Proxy
SOAP To REST API Proxy
 
S E R V L E T S
S E R V L E T SS E R V L E T S
S E R V L E T S
 
The Mule Agent
The Mule AgentThe Mule Agent
The Mule Agent
 
Java Basics
Java BasicsJava Basics
Java Basics
 
Spring MVC
Spring MVCSpring MVC
Spring MVC
 
Oip presentation
Oip presentationOip presentation
Oip presentation
 
Mulesoft Calling Flow of Other Applications
Mulesoft Calling Flow of Other ApplicationsMulesoft Calling Flow of Other Applications
Mulesoft Calling Flow of Other Applications
 
Integration with Sercice-Now using Mule ESB
Integration with Sercice-Now using Mule ESBIntegration with Sercice-Now using Mule ESB
Integration with Sercice-Now using Mule ESB
 
Building Reactive webapp with React/Flux
Building Reactive webapp with React/FluxBuilding Reactive webapp with React/Flux
Building Reactive webapp with React/Flux
 
Scatter gather in mule
Scatter gather in muleScatter gather in mule
Scatter gather in mule
 
Mule Microsoft Share Point 2010 Connector
Mule Microsoft Share Point 2010 ConnectorMule Microsoft Share Point 2010 Connector
Mule Microsoft Share Point 2010 Connector
 
Using mule with web services
Using mule with web servicesUsing mule with web services
Using mule with web services
 
Making design decisions in React-based ClojureScript web applications
Making design decisions in React-based ClojureScript web applicationsMaking design decisions in React-based ClojureScript web applications
Making design decisions in React-based ClojureScript web applications
 
Active mq read and write flow in mule
Active mq  read and write flow in muleActive mq  read and write flow in mule
Active mq read and write flow in mule
 
Scatter and gather in mule
Scatter and gather in muleScatter and gather in mule
Scatter and gather in mule
 
Oip presentation
Oip presentationOip presentation
Oip presentation
 
Oip presentation
Oip presentationOip presentation
Oip presentation
 
Rails concepts
Rails conceptsRails concepts
Rails concepts
 

Viewers also liked

Message queuing telemetry transport (mqtt) launch
Message queuing telemetry transport (mqtt) launchMessage queuing telemetry transport (mqtt) launch
Message queuing telemetry transport (mqtt) launchHamdamboy
 
Push! - MQTT for the Internet of Things
Push! - MQTT for the Internet of ThingsPush! - MQTT for the Internet of Things
Push! - MQTT for the Internet of ThingsDominik Obermaier
 
모바일 메신저 아키텍쳐 소개
모바일 메신저 아키텍쳐 소개모바일 메신저 아키텍쳐 소개
모바일 메신저 아키텍쳐 소개Hyogi Jung
 
Getting started with MQTT - Virtual IoT Meetup presentation
Getting started with MQTT - Virtual IoT Meetup presentationGetting started with MQTT - Virtual IoT Meetup presentation
Getting started with MQTT - Virtual IoT Meetup presentationChristian Götz
 
Low Latency Mobile Messaging using MQTT
Low Latency Mobile Messaging using MQTTLow Latency Mobile Messaging using MQTT
Low Latency Mobile Messaging using MQTTHenrik Sjöstrand
 
MQTT - A practical protocol for the Internet of Things
MQTT - A practical protocol for the Internet of ThingsMQTT - A practical protocol for the Internet of Things
MQTT - A practical protocol for the Internet of ThingsBryan Boyd
 
facebook architecture for 600M users
facebook architecture for 600M usersfacebook architecture for 600M users
facebook architecture for 600M usersJongyoon Choi
 

Viewers also liked (7)

Message queuing telemetry transport (mqtt) launch
Message queuing telemetry transport (mqtt) launchMessage queuing telemetry transport (mqtt) launch
Message queuing telemetry transport (mqtt) launch
 
Push! - MQTT for the Internet of Things
Push! - MQTT for the Internet of ThingsPush! - MQTT for the Internet of Things
Push! - MQTT for the Internet of Things
 
모바일 메신저 아키텍쳐 소개
모바일 메신저 아키텍쳐 소개모바일 메신저 아키텍쳐 소개
모바일 메신저 아키텍쳐 소개
 
Getting started with MQTT - Virtual IoT Meetup presentation
Getting started with MQTT - Virtual IoT Meetup presentationGetting started with MQTT - Virtual IoT Meetup presentation
Getting started with MQTT - Virtual IoT Meetup presentation
 
Low Latency Mobile Messaging using MQTT
Low Latency Mobile Messaging using MQTTLow Latency Mobile Messaging using MQTT
Low Latency Mobile Messaging using MQTT
 
MQTT - A practical protocol for the Internet of Things
MQTT - A practical protocol for the Internet of ThingsMQTT - A practical protocol for the Internet of Things
MQTT - A practical protocol for the Internet of Things
 
facebook architecture for 600M users
facebook architecture for 600M usersfacebook architecture for 600M users
facebook architecture for 600M users
 

Similar to M5 l8-mvc-rails-handout

Similar to M5 l8-mvc-rails-handout (20)

Aril2's template
Aril2's  templateAril2's  template
Aril2's template
 
Rails2's template and respond_to method
Rails2's template and respond_to methodRails2's template and respond_to method
Rails2's template and respond_to method
 
Spring MVC Framework
Spring MVC FrameworkSpring MVC Framework
Spring MVC Framework
 
Asp.net mvc
Asp.net mvcAsp.net mvc
Asp.net mvc
 
RESTful Rails2
RESTful Rails2RESTful Rails2
RESTful Rails2
 
Marata
MarataMarata
Marata
 
Ruby on rails RAD
Ruby on rails RADRuby on rails RAD
Ruby on rails RAD
 
MVC 6 Introduction
MVC 6 IntroductionMVC 6 Introduction
MVC 6 Introduction
 
Asp.net c# MVC-5 Training-Day-1 of Day-9
Asp.net c# MVC-5 Training-Day-1 of Day-9Asp.net c# MVC-5 Training-Day-1 of Day-9
Asp.net c# MVC-5 Training-Day-1 of Day-9
 
Jinal desai .net
Jinal desai .netJinal desai .net
Jinal desai .net
 
Asp.Net MVC3 - Basics
Asp.Net MVC3 - BasicsAsp.Net MVC3 - Basics
Asp.Net MVC3 - Basics
 
MVC Framework
MVC FrameworkMVC Framework
MVC Framework
 
Day7
Day7Day7
Day7
 
Asp.net,mvc
Asp.net,mvcAsp.net,mvc
Asp.net,mvc
 
Angularjs
AngularjsAngularjs
Angularjs
 
Mvc interview questions – deep dive jinal desai
Mvc interview questions – deep dive   jinal desaiMvc interview questions – deep dive   jinal desai
Mvc interview questions – deep dive jinal desai
 
Asp 1a-aspnetmvc
Asp 1a-aspnetmvcAsp 1a-aspnetmvc
Asp 1a-aspnetmvc
 
Aspnetmvc 1
Aspnetmvc 1Aspnetmvc 1
Aspnetmvc 1
 
Spring mvc
Spring mvcSpring mvc
Spring mvc
 
ASP.NET MVC Introduction
ASP.NET MVC IntroductionASP.NET MVC Introduction
ASP.NET MVC Introduction
 

M5 l8-mvc-rails-handout

  • 1. Web Application Architectures Module 5: Middleware Lecture 8: MVC Implementation in Rails c 2011-13 G.L. Heileman Module 5, Lecture 8 1 / 4
  • 2. Ruby on Rails In Rails, the following classes support the MVC design pattern: Model – The ActiveRecord class, described previously, implements object-relational mappings (ORM). View – Views and controllers are actually bundled together in Rails in Action Pack. Dynamic content is generated by templates containing embedded Ruby (ERb) code supported by the ActionView class. Controller – The ActionController class is the core of a web request in Rails. It consists of one or more actions that are executed on request and then either render a template or redirect to another action. An action is defined as a public method on the controller, which will automatically be made accessible to the web-server through Rails Routes. c 2011-13 G.L. Heileman Module 5, Lecture 8 2 / 4
  • 3. MVC Interactions in Rails 1 The browser sends a request to the web server. 1 The browser sends a request to the web server. 2 The web server processes the request, determines which route it belongs to and dispatches that request to the corresponding controller method. 1 The browser sends a request to the web server. 2 The web server processes the request, determines which route it belongs to and dispatches that request to the corresponding controller method. 3 The controller asks the model layer for all of the information needed to complete the request. 1 The browser sends a request to the web server. 2 The web server processes the request, determines which route it belongs to and dispatches that request to the corresponding controller method. 3 The controller asks the model layer for all of the information neededc 2011-13 G.L. Heileman Module 5, Lecture 8 3 / 4
  • 4. MVC Interactions in Rails Browser Web Server Routes Dispatcher Controller Model View 1 2 http://localhost:3000/posts PostsController::index 3 @posts = Post.all 5 @posts 4 Post array 8 text/html 6 index.html.erb resources :posts 7 application.html.erb + index.html (response)(GET request) c 2011-13 G.L. Heileman Module 5, Lecture 8 4 / 4