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 about 1 year ago
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 %>
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 15 Introduction to Rails.
Lecture 11 Server Side Interaction Boriana Koleva Room: C54
Chapter 6 Server-side Programming: Java Servlets CSI3140 WWW Structures, Techniques, and Standards.
M-V-C for web applications. Model for Web Applications model consists of data and system state database tables –persistent data session information –current.
Other Web Application Development Technologies. PHP.
May 13th, Lucek Consulting Basic Java Servlet/JSP Web Development David Lucek Lucek Consulting
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 16 Introduction to Ajax.
JQuery MessageBoard. Lets use jQuery and AJAX in combination with a database to update and retrieve information without refreshing the page. Here we will.
Contents Client-data script It refers to class of computer programs on the web that are executed client-side, by the user`s web browser, instead of server.
LIS651 lecture 0 Gathering and showing data Thomas Krichel
PHP II Interacting with Database Data. The whole idea of a database-driven website is to enable the content of the site to reside in a database, and to.
PHP I. PHP, or PHP Hypertext Preprocessor is a server-side scripting language. Originally created in 1994 by Rasmus Lerdorf, to track users at his web.
1 Introduction to ASP.NET. 2 Static and Dynamic Web Applications HTML is used to create static content Browser software interprets HTML tags and formats.
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 10 Servlets and Java Server Pages.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Slide STARTING OUT WITH Visual Basic 2008 FOURTH EDITION Tony Gaddis.
EPrints Web Configuratio n Management. SQL database Web server Scripts to configure repository activities Configuration files EPrints - the Administrator's.
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 9 Using Perl for CGI Programming.
Implementation Architecture Lecture Implementation View (1) “ how the system is built ” Focuses on “ how the system is built ” technological.
Designing Web Applications. client server architectures design patterns model 2 web applications.
(Advanced) Web Application Development Test Driven Development with Ruby and Rails Bruce Scharlau, University of Aberdeen, 2013.
Ch-10 Configuration Management. Introduction A software project produces a number of items during its execution including various documents, manuals,
Database Management. Module 6 Objectives Next Discuss the functions common to most DBMSs Identify the qualities of valuable information Explain why data.
LIS650lecture 0 Introductory lecture Thomas Krichel
LIS650lecture 0 Re-Introductory lecture Thomas Krichel
PHP II PHP Form and File Handling. PHP Forms The PHP $_GET and $_POST variables/arrays are used to retrieve information from forms. The $_GET variable.
Database Connections with ASP.Net A large number of computer applicationsboth desktop and web applicationsare data-driven. These applications are largely.
State of Connecticut Core-CT Project Query 8 hrs Updated 4/14/2003.
Jump to Contents Instructor Tutorial essignments.com Paperless assignment submission system.
© 2016 SlidePlayer.com Inc. All rights reserved.