We think you have liked this presentation. If you wish to download it, please recommend it to your friends in any social system. Share buttons are a little bit lower. Thank you!
Presentation is loading. Please wait.
Published byCallie Goodspeed
Modified over 2 years ago
Chapter 15 © 2010 by Addison Wesley Longman, Inc. 2 15.1 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. 5 15.1 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 http://instantrails.rubyforge.org/wiki/wiki.pl - Includes Ruby, Rails, MySQL, Apache and everything else that is necessary
Chapter 15 © 2010 by Addison Wesley Longman, Inc. 6 15.2 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. 7 15.2 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. 8 15.3 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. 9 15.3 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. 10 15.3 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 %>
Chapter 15 © 2013 by Pearson Overview of Rails - Rails is a development framework for Web-based applications - Based on MVC architecture for applications.
Chapter 15 © 2009 by Addison Wesley Longman, Inc Overview of Rails - Rails is a development framework for Web-based applications - Rails is written.
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 15 Introduction to Rails.
Creating Web Services with Ruby on Rails Robert Thew Internet and Web Systems II.
Rails & Ajax Module 5. Introduction to Rails Overview of Rails Rails is Ruby based “A development framework for Web-based applications” Rails uses the.
UC Berkeley Hello Rails. Review: MVC Goal: separate organization of data (model) from UI & presentation (view) by introducing controller –mediates user.
Web Programming Overview. Introduction HTML is limited - it cannot manipulate data How Web pages are extended (include): –Java: an object-oriented programming.
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.
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.
Lecture 11 Server Side Interaction
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.
TM 8-1 Copyright © 1999 Addison Wesley Longman, Inc. Client/Server and Middleware.
School of Informatics University of Edinburgh An Introduction to Ruby on Rails Ken Dawson.
Ruby on Rails Creating a Rails Application Carol E Wolf CS396X.
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.
Chapter 6 Server-side Programming: Java Servlets
Lecture 19 Web Application Frameworks Boriana Koleva Room: C54
Web Application Programming Carol Wolf Computer Science.
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.
M. Taimoor Khan * Java Server Pages (JSP) is a server-side programming technology that enables the creation of dynamic,
Creating Dynamic Web Pages Using PHP and MySQL CS 320.
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.
NMD202 Web Scripting Week5. What we will cover today PHP & MySQL Displaying Dynamic Pages Exercises Modifying Data PHP Exercises Assignment 1.
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.
| Lugano, Ruby on Rails.
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.
NMED 3850 A Advanced Online Design January 12, 2010 V. Mahadevan.
CSS Class 6 Make image into a button Create button with button element Group related form elements Control tab order Process form data.
Date : 3/04/2010 Web Technology Solutions Class: PHP Web Application Frameworks.
Rails and Grails. To get started Make sure you have java installed You can get the sdk and jre at:
Multiple Tiers in Action
RUBRIC IP1 Ruben Botero Web Design III. The different approaches to accessing data in a database through client-side scripting languages. – On the client.
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.
Database Systems: Design, Implementation, and Management Eighth Edition Chapter 14 Database Connectivity and Web Technologies.
10 Adding Interactivity to a Web Site Section 10.1 Define scripting Summarize interactivity design guidelines Identify scripting languages Compare common.
Chapter 1: Introduction to Web
Kingdom of Saudi Arabia Ministry of Higher Education Al-Imam Muhammad Ibn Saud Islamic University College of Computer and Information Sciences Chapter.
Web Development & Design Foundations with XHTML Chapter 9 Key Concepts.
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.
Putting What We Learned Into Context – WSGI and Web Frameworks A290/A590, Fall /16/2014.
Ruby on Rails: An Introduction JA-SIG Summer Conference 2007 Michael Irion The University of Tulsa.
Web 2.0 with AJAX Students : LASC Ioana KELEMEN Csilla POP Dan Adrian CIOBANU Dumitru Daniel Project leader : Ahmed RHIAT.
DT211/3 Internet Development Application Internet Development Application.
Basics Components of Web Design & Development Basics, Components, Design and Development.
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.
Overview Web Technologies Computing Science Thompson Rivers University.
© 2017 SlidePlayer.com Inc. All rights reserved.