XML and Ruby on Rails Jennifer Andrews LIS 531F April 25,2007.

Slides:



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

© 2011 Delmar, Cengage Learning Chapter 1 Getting Started with Dreamweaver.
Samsung Smart TV is a web-based application running on an application engine installed on digital TVs connected to the Internet.
The Librarian Web Page Carol Wolf CS396X. Create new controller  To create a new controller that can manage more than just books, type ruby script/generate.
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.
Introduction to Model-View-Controller (MVC) Web Programming with TurboGears Leif Oppermann,
Project 1 Introduction to HTML.
Ruby on Rails by Manik Juneja Ruby On Rails. Ruby on Rails by Manik Juneja Rails is a Web Application development framework. Based on the MVC pattern.
Databases Chapter Distinguish between the physical and logical view of data Describe how data is organized: characters, fields, records, tables,
Chapter 3 Database Management
15 Chapter 15 Web Database Development Database Systems: Design, Implementation, and Management, Fifth Edition, Rob and Coronel.
3-1 Chapter 3 Data and Knowledge Management
Chapter 4: Database Management. Databases Before the Use of Computers Data kept in books, ledgers, card files, folders, and file cabinets Long response.
Copyright 2003 The McGraw-Hill Companies, Inc CHAPTER Application Software computing ESSENTIALS    
Computer Science 101 Web Access to Databases Overview of Web Access to Databases.
Mgt 240 Lecture Website Construction: Software and Language Alternatives March 29, 2005.
1 Chapter 20 — Creating Web Projects Microsoft Visual Basic.NET, Introduction to Programming.
HTML 1 Introduction to HTML. 2 Objectives Describe the Internet and its associated key terms Describe the World Wide Web and its associated key terms.
1 Introduction to Web Development. Web Basics The Web consists of computers on the Internet connected to each other in a specific way Used in all levels.
Ruby on Rails CSCI 6314 David Gaspar Jennifer Garcia Avila.
Introduction to MVC Adding Model Classes NTPCUG Tom Perkins, Ph.D.
Architecture Of ASP.NET. What is ASP?  Server-side scripting technology.  Files containing HTML and scripting code.  Access via HTTP requests.  Scripting.
UC Berkeley Hello Rails. Review: MVC Goal: separate organization of data (model) from UI & presentation (view) by introducing controller –mediates user.
Databases C HAPTER Chapter 10: Databases2 Databases and Structured Fields  A database is a collection of information –Typically stored as computer.
Server-side Scripting Powering the webs favourite services.
XP New Perspectives on Browser and Basics Tutorial 1 1 Browser and Basics Tutorial 1.
Simple Database.
LiveCycle Data Services Introduction Part 2. Part 2? This is the second in our series on LiveCycle Data Services. If you missed our first presentation,
Lecture 19 Web Application Frameworks Boriana Koleva Room: C54
PHP meets MySQL.
1 Dr Alexiei Dingli Web Science Stream Introducing Rails.
Putting it all together Dynamic Data Base Access Norman White Stern School of Business.
Discovering Computers Fundamentals Fifth Edition Chapter 9 Database Management.
1.NET Web Forms Business Forms © 2002 by Jerry Post.
Storing Organizational Information - Databases
Database What is a database? A database is a collection of information that is typically organized so that it can easily be storing, managing and retrieving.
InfoBox A Personal Information Manager Built with Ruby on Rails Dustin Martin.
INFO1408 Database Design Concepts Week 15: Introduction to Database Management Systems.
Rails & Ajax Module 5. Introduction to Rails Overview of Rails Rails is Ruby based “A development framework for Web-based applications” Rails uses the.
GIS Data Models GEOG 370 Christine Erlien, Instructor.
Chapter 15 © 2013 by Pearson Overview of Rails - Rails is a development framework for Web-based applications - Based on MVC architecture for applications.
Building Dashboards SharePoint and Business Intelligence.
ASP. What is ASP? ASP stands for Active Server Pages ASP is a Microsoft Technology ASP is a program that runs inside IIS IIS stands for Internet Information.
Create, Update and Delete Carol Wolf Computer Science.
Reading Flash. Training target: Read the following reading materials and use the reading skills mentioned in the passages above. You may also choose some.
1 © Xchanging 2010 no part of this document may be circulated, quoted or reproduced without prior written approval of Xchanging. MOSS Training – UI customization.
Chapter 10 Database Management. Data and Information How are data and information related? p Fig Next processing data stored on disk Step.
HTML Concepts and Techniques Fifth Edition Chapter 1 Introduction to HTML.
© 2003 Prentice Hall, Inc.3-1 Chapter 3 Database Management Information Systems Today Leonard Jessup and Joseph Valacich.
CPSC 203 Introduction to Computers T97 By Jie (Jeff) Gao.
Working with XML. Markup Languages Text-based languages based on SGML Text-based languages based on SGML SGML = Standard Generalized Markup Language SGML.
Chapter 1 Introduction to HTML, XHTML, and CSS HTML5 & CSS 7 th Edition.
CS 160 and CMPE/SE 131 Software Engineering February 9 Class Meeting Department of Computer Science Department of Computer Engineering San José State University.
Introduction to Databases Angela Clark University of South Alabama.
Presentation on Database management Submitted To: Prof: Rutvi Sarang Submitted By: Dharmishtha A. Baria Roll:No:1(sem-3)
CS 160 and CMPE/SE 131 Software Engineering February 11 Class Meeting Department of Computer Science Department of Computer Engineering San José State.
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.
Introduction to Core Database Concepts Getting started with Databases and Structure Query Language (SQL)
Basics Components of Web Design & Development Basics, Components, Design and Development.
Generating XML Data from a Database Eugenia Fernandez IUPUI.
Imposing MVC design sample in.NET. Design patterns are very useful to solve complex design issues if used well. The primary concept of the Model View.
Neo4j: GRAPH DATABASE 27 March, 2017
Project 1 Introduction to HTML.
Design and Maintenance of Web Applications in J2EE
Ruby on Rails by Manik Juneja
Ruby on Rails by Manik Juneja
Lecture 1: Multi-tier Architecture Overview
Chapter 15 Introduction to Rails.
Chapter 3 Database Management
Geographic Information Systems
Presentation transcript:

XML and Ruby on Rails Jennifer Andrews LIS 531F April 25,2007

Strengths of databases Effective searching Efficient data storage (no redundancy) Scalable Reliable Good security features Been around a long time Part of the business structure

Strengths of XML Human readable Open standard, not tied to a platform Structure part of document facilitates transfer and sharing of information Flexible Becoming more important with increase of information sharing across businesses and applications

Relational Database Stores data in tables made up of rows and columns Each row represents a record Order of records irrelevant Many tables connected by “keys” Can express complex relationships between tables

XML Hierarchical Harder to express complex relationships Order of data important Preservation of order?

Ruby on Rails Based on Ruby Web based database applications Basic structure built into Rails All pieces of the application interact in standard way Advantage? Easy and speedy development of applications OPEN SOURCE

Architecture MVC or Model, View, Controller Controller = conductor Model = data handling, enforces “rules” Views = HTML, interface for interaction with user, but only displays, never handles data

Step 1 – create database and tables using SQL

New material Fiber Weight Back Brand Color

Table in SQL

Now what? Create an XML document Create view or “template” saved as.rxml One small piece of code in the controller Point browser to that view And …..

Code to generate XML resides in template xml.instruct! :xml, :version=>"1.0" xml.channel { for m xml.material do xml.title(m.fiber) xml.description(m.weight) xml.brand(m.brand) xml.color(m.color) end end }

Material Controller class MaterialController < ApplicationController def index list render :action => 'list' end # GETs should be safe (see verify :method => :post, :only => [ :destroy, :create, :update ], :redirect_to => { :action => :list } = paginate :materials, :per_page => 10 end def = Material.find(params[:id]) end def = Material.new end def = Material.new(params[:material]) flash[:notice] = 'Material was successfully created.' redirect_to :action => 'list' else render :action => 'new' end def = Material.new(params[:material]) flash[:notice] = 'Material was successfully created.' redirect_to :action => 'list' else render :action => 'new' end def = Material.find(params[:id]) end def = Material.find(params[:id]) flash[:notice] = 'Material was successfully updated.' redirect_to :action => 'show', :id else render :action => 'edit' end def destroy Material.find(params[:id]).destroy redirect_to :action => 'list' end def = Material.find(:all) render :layout => false end

How does it happen? MAGIC! A piece of Ruby code called Builder Takes what is after the xml. and turns it into a tag – xml.description becomes –can include attibutes, too xml.price(p.price, currency => “USD”) becomes

Real Life Application Rails app collecting orders for books Part of that process – collecting names, addresses Marketing department wants names of all who bought a certain book (in XML) to feed into a another program they have.

Another way Autogenerate through command called to_xml Dumps everything No control over order of elements Possible to add code so if a request comes for HTML – that is what’s returned, if the request is for XML, that is what is returned

Bits and pieces Can you use XML to input data into RonR? Installing RonR on computer –Locomotive 2 tutorials Put your XML knowledge to use Start simple, ride the rails, and be amazed