Chapter 15 © 2010 by Addison Wesley Longman, Inc. 1 14.1 Origins and Uses of Ruby - Designed by Yukihiro Matsumoto; released in 1996 - Use spread rapidly.

Slides:



Advertisements
Similar presentations
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 15 Introduction to Rails.
Advertisements

Copyright © 2004 ProsoftTraining, All Rights Reserved. Lesson 11: Advanced Web Technologies.
Lecture 11 Server Side Interaction
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.
Creating Web Services with Ruby on Rails Robert Thew Internet and Web Systems II.
Ruby on Rails Tutorial Peter Mosca April, Ruby on Rails Tutorial Ruby History Invented 12 years ago in Japan by Yukihiro Matsumoto Spent first 5.
What is it? –Large Web sites that support commercial use cannot be written by hand What you’re going to learn –How a Web server and a database can be used.
Creating Web Services with Ruby on Rails Robert Thew Internet and Web Systems II.
Week 2 IBS 685. Static Page Architecture The user requests the page by typing a URL in a browser The Browser requests the page from the Web Server The.
Multiple Tiers in Action
27-Jun-15 Rails. What is Rails? Rails is a framework for building web applications This involves: Getting information from the user (client), using HTML.
Computer Science 101 Web Access to Databases Overview of Web Access to Databases.
Ruby on Rails Creating a Rails Application Carol E Wolf CS396X.
2440: 141 Web Site Administration Web Server-Side Programming Professor: Enoch E. Damson.
Web 2.0 with AJAX Students : LASC Ioana KELEMEN Csilla POP Dan Adrian CIOBANU Dumitru Daniel Project leader : Ahmed RHIAT.
 2004 Prentice Hall, Inc. All rights reserved. Chapter 25 – Perl and CGI (Common Gateway Interface) Outline 25.1 Introduction 25.2 Perl 25.3 String Processing.
Web Development & Design Foundations with XHTML Chapter 9 Key Concepts.
Server Side Scripting Norman White. Where do we do processing? Client side – Javascript (embed code in html) – Java applets (send java program to run.
Ruby on Rails: An Introduction JA-SIG Summer Conference 2007 Michael Irion The University of Tulsa.
| Lugano, Ruby on Rails.
RUBY ON RAILS It’s so rad. What we’ll cover  What is Ruby?  What is RoR?  Why RoR?  Developing with RoR  Deployment  Demo  Questions.
M. Taimoor Khan * Java Server Pages (JSP) is a server-side programming technology that enables the creation of dynamic,
Rails and Grails. To get started Make sure you have java installed You can get the sdk and jre at:
CSS Class 6 Make image into a button Create button with button element Group related form elements Control tab order Process form data.
UC Berkeley Hello Rails. Review: MVC Goal: separate organization of data (model) from UI & presentation (view) by introducing controller –mediates user.
 2003 Prentice Hall, Inc. All rights reserved. CHAPTER 3 JavaScript 1.
Chapter 1: Introduction to Web
Basics of Web Databases With the advent of Web database technology, Web pages are no longer static, but dynamic with connection to a back-end database.
Web Application Programming Carol Wolf Computer Science.
Simple Database.
10 Adding Interactivity to a Web Site Section 10.1 Define scripting Summarize interactivity design guidelines Identify scripting languages Compare common.
Putting What We Learned Into Context – WSGI and Web Frameworks A290/A590, Fall /16/2014.
 2001 Prentice Hall, Inc. All rights reserved. 1 Chapter 21 - Web Servers (IIS, PWS and Apache) Outline 21.1 Introduction 21.2 HTTP Request Types 21.3.
Lecture 19 Web Application Frameworks Boriana Koleva Room: C54
1 In the good old days... Years ago… the WWW was made up of (mostly) static documents. –Each URL corresponded to a single file stored on some hard disk.
Introduction to Applets CS 3505 Client Side Scripting with applets.
Creating Dynamic Web Pages Using PHP and MySQL CS 320.
NMED 3850 A Advanced Online Design January 12, 2010 V. Mahadevan.
MACIASZEK, L.A. (2001): Requirements Analysis and System Design. Developing Information Systems with UML, Addison Wesley Chapter 6 - Tutorial Guided Tutorial.
 2003 Prentice Hall, Inc. All rights reserved. CHAPTER 3 JavaScript 1.
Kingdom of Saudi Arabia Ministry of Higher Education Al-Imam Muhammad Ibn Saud Islamic University College of Computer and Information Sciences Chapter.
Chapter 6 Server-side Programming: Java Servlets
Chapter 15 © 2009 by Addison Wesley Longman, Inc Overview of Rails - Rails is a development framework for Web-based applications - Rails is written.
Rails & Ajax Module 5. Introduction to Rails Overview of Rails Rails is Ruby based “A development framework for Web-based applications” Rails uses the.
RUBRIC IP1 Ruben Botero Web Design III. The different approaches to accessing data in a database through client-side scripting languages. – On the client.
Chapter 15 © 2013 by Pearson Overview of Rails - Rails is a development framework for Web-based applications - Based on MVC architecture for applications.
NMD202 Web Scripting Week5. What we will cover today PHP & MySQL Displaying Dynamic Pages Exercises Modifying Data PHP Exercises Assignment 1.
IS-907 Java EE World Wide Web - Overview. World Wide Web - History Tim Berners-Lee, CERN, 1990 Enable researchers to share information: Remote Access.
WHAT IS SERVER SIDE SCRIPTING? Server-side scripting is a web server technology in which a user's request is verified by running a script directly on the.
Date : 3/04/2010 Web Technology Solutions Class: PHP Web Application Frameworks.
Database Systems: Design, Implementation, and Management Eighth Edition Chapter 14 Database Connectivity and Web Technologies.
Web Programming Overview. Introduction HTML is limited - it cannot manipulate data How Web pages are extended (include): –Java: an object-oriented programming.
TM 8-1 Copyright © 1999 Addison Wesley Longman, Inc. Client/Server and Middleware.
COSC 2328 – Web Programming.  PHP is a server scripting language  It’s widely-used and free  It’s an alternative to Microsoft’s ASP and Ruby  PHP.
Overview Web Technologies Computing Science Thompson Rivers University.
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.
Basics Components of Web Design & Development Basics, Components, Design and Development.
School of Informatics University of Edinburgh An Introduction to Ruby on Rails Ken Dawson.
Web Technology Solutions
Web Technologies Computing Science Thompson Rivers University
Introduction to Dynamic Web Programming
Introduction and Principles
CO6025 Advanced Programming
PHP / MySQL Introduction
Chapter 15 Introduction to Rails.
Web Technologies Computing Science Thompson Rivers University
Client-Server Model: Requesting a Web Page
Web Servers (IIS and Apache)
Web Application Development Using PHP
Presentation transcript:

Chapter 15 © 2010 by Addison Wesley Longman, Inc Origins and Uses of Ruby - Designed by Yukihiro Matsumoto; released in Use spread rapidly in Japan - Use is now growing in part because of its use in Rails - A pure object-oriented purely interpreted scripting language - Related to Perl and JavaScript, but not closely

Chapter 15 © 2010 by Addison Wesley Longman, Inc Overview of Rails - Rails is a development framework for Web-based applications - Rails is written in Ruby and uses Ruby for its applications - Ruby on Rails (RoR) - Based on MVC architecture for applications - MVC cleanly separates applications into three parts: - Model – the data and any restraints on it - View – prepares and presents results to the user - Controller – controls the application - One characterizing part of Rails is its approach to connecting object-oriented software with a relational database – ORM - Maps tables to classes, rows to objects, and columns to fields of the objects

Chapter 15 © 2010 by Addison Wesley Longman, Inc. 3 Architecture of a Four-Tier Application DBMS / Database Server Database User Interface Database Engine Supporting Software Application Server Database API Application Logic App User Interface W EB S E R V E R Architecture of a Four-Tier Application W EB C L I E N T

Chapter 15 © 2010 by Addison Wesley Longman, Inc. 4 Architecture of a Four-Tier Application MySQL Database User Interface Database Engine Supporting Software Rails Model Control View TOMCATTOMCAT ROR MVC Architecture WEBCLIENTWEBCLIENT

Chapter 15 © 2010 by Addison Wesley Longman, Inc Overview of Rails (continued) - View documents are XHTML documents that may include Ruby code - Most of the controller code is provided by Rails - A Rails application is a program that provides a response when a client browser connects to a Rails-driven Web site - Rails can be used with Ajax - Two fundamental principles that guided the development of Rails: 1. DRY 2. Convention over configuration - Rails does not use a GUI - One simple way to get started with Rails is to download a complete development system - Includes Ruby, Rails, MySQL, Apache and everything else that is necessary

Chapter 15 © 2010 by Addison Wesley Longman, Inc Document Requests (continued) - Static Documents (continued) - Next, build the view file, or template, which must reside in the say subdirectory of the views directory of the application and be named hello.html.erb - This is an XHTML document with the following in its body element Hello from Rails! - To test the application, a Web server must be started >ruby script/server - This starts the default server, named Mongrel - Now, pointing the browser to the application produces the displayed view template content

Chapter 15 © 2010 by Addison Wesley Longman, Inc Document Requests (continued) - Dynamic Documents - Dynamic documents can be built with Rails by embedding Ruby code in the template document - An example: display a greeting and the current date and time and the number of seconds since midnight - Ruby code is embedded in a document by placing it between - To insert the result of evaluating the code into the document, use <%= - The Time class has a method, now, that returns the current day of the week, month, day of the month, time, time zone, and year, as a string It is now Number of seconds since midnight:

Chapter 15 © 2010 by Addison Wesley Longman, Inc Rails Applications with Databases - We will use MySQL - Use a simple database with just one table - The application will be named cars - The application will present a welcome document to the user, including the number of cars in the database and a form to get the beginning and ending years and a body style for the desired car - Creating the application - In the subdirectory of our examples: >rails –d mysql cars - It is customary to use three databases in a Rails database application: one for development, one for testing, and one for production - To create the three (empty) databases: >rake db:create:all - Creates the database.yml file in the config subdirectory of the application directory ( cars ) - See next page

Chapter 15 © 2010 by Addison Wesley Longman, Inc Rails Applications with Databases (continued) - If we fill out the form, as in: - Now we click Create, which produces:

Chapter 15 © 2010 by Addison Wesley Longman, Inc Rails Applications with Databases (continued) Listing corvettes Body style Miles Year <%= link_to 'Edit', edit_corvette_path(corvette) %> <%= link_to 'Destroy', corvette, :confirm => 'Are you sure?', :method => :delete %>