Ruby on Rails Controller of MVC. Routes How we map URIs like /tweets/1 to calling the show method of the Controller.

Slides:



Advertisements
Similar presentations
Struts Portlet Copyright © Liferay, Inc. All Rights Reserved. No material may be reproduced electronically or in print without written permission.
Advertisements

2.744 Dreamweaver Tutorial Sangmok Han Feb 24, 2010.
INTRODUCTION TO ASP.NET MVC AND EXAMPLE WALKTHROUGH RAJAT ARYA EFECS - OIM DAWG – 4/21/2009 ASP.NET MVC.
Introduction to MVC Adding a View Page NTPCUG Tom Perkins, Ph.D.
In this lecture, you will learn: ❑ How to link between pages of your site ❑ How to link to other sites ❑ How to structure the folders on your web site.
Ruby on Rails Model of MVC. Model-View-Controller Paradigm A way of organizing a software system Benefits: Isolation of business logic from the user interface.
FM Web Scraping FMPUG: Dallas Chapter Taylor Made Services: FileMaker Presentation March 6, 2009 Dallas Texas.
® IBM Software Group © 2006 IBM Corporation Additional AJAX Examples and Workshops This learning module provides additional AJAX use cases and examples.
AudioBoo Because sound is social. Overview Instruct how to create an Audioboo account Demonstrate how to follow a featured boo Learn how to upload a video.
How to Establish a Blog. What is a Blog A blog is a collection of informational articles/ideas intended to update a viewer on new information associated.
Servlets Life Cycle. The Servlet Life Cycle A servlet life cycle can be defined as the entire process from its creation till the destruction. The following.
How To Create a Blog in Sharepoint For Secondary Educators.
Ruby on Rails (Slides modified by ements-2ed.shtml)
Themes & Layout Tutorial Copyright © Liferay, Inc. All Rights Reserved. No material may be reproduced electronically or in print without written.
AMS304: Introduction to the ASP.NET Model View Controller (MVC) Framework Scott Hanselman Eilon Lipton Microsoft Microsoft
Ruby on Rails. What is Ruby on Rails? Ruby on Rails is an open source full-stack web framework. It is an alternative to PHP/MySQL. It can render templates,
MVC in Trax.
Anchor Splash! Your Step-by-Step Guide. Step 1 Fill out the Anchor Splash Survey DG will verify and approve your information MemberPlanet will build your.
Rails and Grails. To get started Make sure you have java installed You can get the sdk and jre at:
Server-side Scripting Powering the webs favourite services.
SIMPLE ROUTER The slide made by Salim Malakouti. Next we will create the Router  What do I we mean by a router?  Routers work similar to a map. It receives.
Struts Portlet Redirect Copyright © Liferay, Inc. All Rights Reserved. No material may be reproduced electronically or in print without written.
Dreamweaver – Dreamweaver Extras Web Design Section 8-4 Part or all of this lesson was adapted from the University of Washington’s “Web Design & Development.
MVC & ActiveRecord by Christian Mohr & Mohamed Souiai.
Standalone Java Application vs. Java Web Application
Advanced i ServiceDesk Setup and Customization Tim Prado Dan Maddux TMA Systems.
Lecture 11 Rails Topics SaaSSaaS Readings: SaaS book Ch February CSCE 740 Software Engineering.
Ruby on Rails CSE 190M, Spring 2009 Week 6. Overview How to use a database Demo creating a blog application on Rails Explain how the application works.
Basic Instructions on how to use One Drive and share files. ONE Drive Your LogoYour own footer.
PowerTeacher with Web Grade Book Semester Classes School Year August 2012.
MVC Concepts Basics Model-View-Controller (MVC) Concepts for Web Developers SoftUni Team Technical Trainers Software University
Build Your Own Website Review of week 3 Editing your header Editing your header Creating and navigating to hidden pages Creating and navigating to hidden.
PHP Form Introduction Getting User Information Text Input.
Routes & REST & URL-helpers & validations & filters
Introduction to MVC Controllers NTPCUG Tom Perkins, Ph.D.
Create, Update and Delete Carol Wolf Computer Science.
Lecture 13b Rails – Controllers and Views Topics SaaSSaaS Readings: SaaS book Ch March 3, 2014 CSCE 740 Software Engineering.
This is an example of an interactive PowerPoint presentation click the button to find out more Enter.
Welcome to the Minnesota SharePoint User Group February 13 th, 2013 SharePoint 2013 – Developers Track - Client Side Rendering.
Rails and routing INFO 2310: Topics in Web Design and Programming.
Class03 Introduction to Web Development (Hierarchy and the IDE) MIS 3501, Spring 2016 Jeremy Shafer Department of MIS Fox School of Business Temple University.
CS 160 and CMPE/SE 131 Software Engineering February 9 Class Meeting Department of Computer Science Department of Computer Engineering San José State University.
Google Merchant Center Feed Process Manohar Bennuri.
Presented by Karen Porter UM School of Business Administration & ImpactOnlineMarketing.com Getting Familiar with the Dashboard.
Introduction to JavaScript MIS 3502, Spring 2016 Jeremy Shafer Department of MIS Fox School of Business Temple University 2/2/2016.
Your final site CSS WP Hand- code, using TextEdit, TextWrangler, Dreamweaver or any other wysiwyg editor. Site doesn’t require to be hosted Deliver all.
Section led by Ivan Lee Reachable at ivan period lee at cs period stanford period edu 1.
Ruby on Rails. Web Framework for Ruby Designed to make it easier to develop, deploy, and maintain web applications Design with Model-View-Controller –almost.
Modern Development Technologies in SharePoint SHAREPOINT SATURDAY OMAHA APRIL, 2016.
1 ERP Support Portal ERP Department 25 th November 2015 User Guide.
WebViews UIWebView. Controller Architecture UITabBarController Controls the first view that the user sees The view controller class (and xib) that manages.
Routes Carol Wolf Computer Science. RESTful Architecture  Rails uses REST-style architecture: representation state transfer  resources :courses in routes.rb.
1 Using MVC 6. MVC vs. ASP Web Forms Both run under ASP.NET Can coexist In Web Forms, browser requests page. xxx.aspx and xxx.aspx.cs on the server Page.
MVC Controllers TestsMigrations Ye Olde Internet Model DB Server Router View Browser Today’s focus Controller.
Introduction to .NET Florin Olariu
Weebly Elements, Continued
Weebly Elements, Continued
The Login Page is the first page your customers
Introduction to Web Development (Part 2)
Play Framework: Introduction
Introduction to MVC PHP Web Development Ivan Yonkov Training Manager
Easy Way to Improve Your 404 Page Template in Wordpress If you want to improve your 404 error page. So we are here to explain to you how to improve your.
Website URL
❶ Start by selecting the MEPS – area where the motor will be placed
REST.
Controllers.
MVC Controllers.
MVC Controllers.
ASP.NET MVC Web Development
MVC Controllers.
Presentation transcript:

Ruby on Rails Controller of MVC

Routes How we map URIs like /tweets/1 to calling the show method of the Controller

Routes defined in routes.rb file NOTE: resources :tweets  means map routes of standard URIs to standard Controller method names (as shown below) so /tweets  index AND /tweet/1  show

resources :tweets This is a great short cut rather than making mappings for each of the default RESTFUL request on next slide

RESTful controller actions possible and the methods they invoke for users (zombie example)

resources :users If you add to routes.rb file the following line resources :users it will setup the following mappings (see resources :photos HTTP requestURI PathController#ActionUsed for GET/usersuser#indexdisplay a list of all users GET/users/newuser#newreturn an HTML form for creating a new user POST/usersuser#createcreate a new user GET/users/:iduser#showdisplay a specific user GET/users/:id/edituser#editreturn an HTML form for editing a user PATCH/PUT/users/:idusers#updateupdate a specific user DELETE/users/:idusers#destroydelete a specific user

How about for tweets: Different URI invoked methods in our Controller class Each URI type will invoke a different predefined method in the Controller class. YOU HAVE to write the code in your Controller class for each method. Example URI /tweets/2/edit will invoke edit method Remember add resources :tweets to routes.rb to quickly add all the maps related to these methods

Let’s add the edit method to Controller URI /tweets/2/edit edit method inside controller View edit.html.erb By DEFAULT the edit method at end will call the edit view edit.html.erb Fill in form fields

Continuing with the Zombie tutorial Rememver following file structure now

Remember our show.html.erb View In app/views/tweets/show.html.erb … ….. Posted by NOTE: A View here is calling directly a Model (Tweet). While this can work, it is not the intention of MVC. FIX: we need to replace this with Controller code.

What we want instead…. Is a Controller that has a SHOW method 1: request /tweets/1 3: the controller then invokes the view show.html.erb

But what about CUSTOM Routes Example want URI /new_tweet  Tweet Controller’s new method

Using Routes to redirect a URI Suppose you want /all to redirect to the URI /tweets ADD the following code in our routes.rb ZombieTwitter::Application.routes.draw do

Root Route  what users sees when types in URL with no path ADD the following code in our routes.rb ZombieTwitter::Application.routes.draw do

Do you finally see how through Rails structure you create a website???