Ruby on Rails Presenter: Michael Mayer 30-March-2006 Network RPI This presentation was adapted from a ThoughtWise presentation By Obie Fernandez;

Slides:



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

EIONET Training Zope Page Templates Miruna Bădescu Finsiel Romania Copenhagen, 28 October 2003.
Apache Struts Technology
Ruby (on Rails) CSE 190M, Spring 2009 Week 3. Web Programming in Ruby Ruby can be used to write dynamic web pages Similar to PHP, chunks of Ruby begins.
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.
Chapter 15 © 2010 by Addison Wesley Longman, Inc Origins and Uses of Ruby - Designed by Yukihiro Matsumoto; released in Use spread rapidly.
Web Applications Development Using Coldbox Platform Eddie Johnston.
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.
1 Chapter 12 Working With Access 2000 on the Internet.
Fast Track to ColdFusion 9. Getting Started with ColdFusion Understanding Dynamic Web Pages ColdFusion Benchmark Introducing the ColdFusion Language Introducing.
Peoplesoft: Building and Consuming Web Services
ASP.NET Programming with C# and SQL Server First Edition
Ruby on Rails CSE 190M, Spring 2009 Week 5. Installing Rails First, install Ruby with RubyGems Then, install the Rails gem gem install rails -version=2.3.2.
Ruby on Rails Presentation to Agile Atlanta Group Originally presented May 10 ‘05 Obie Fernandez Agile AtlantaAgile Atlanta Founder / ThoughtWorksThoughtWorks.
Ruby on Rails (Slides modified by ements-2ed.shtml)
Christopher M. Pascucci Basic Structural Concepts of.NET Browser – Server Interaction.
DAT304 Leveraging XML and HTTP with Sql Server Irwin Dolobowsky Program Manager Webdata Group.
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.
ZFApp Preview Walkthrough. What is ZFApp? ZFApp is an application framework built on top of Zend Framework Fully compatible with the latest ZF Versions.
Rails and Grails. To get started Make sure you have java installed You can get the sdk and jre at:
JSP Standard Tag Library
Web Applications Harry R. Erwin, PhD University of Sunderland CIT304/CSE301.
AIT 616 Fall 2002 PHP. AIT 616 Fall 2002 PHP  Special scripting language used to dynamically generate web documents  Open source – Free!!!  Performs.
What is Sure BDCs? BDC stands for Batch Data Communication and is also known as Batch Input. It is a technique for mass input of data into SAP by simulating.
SCRIPTING IN RUBY By Amber Bennett “Ruby is simple in appearance, but is very complex inside, just like our human body.” --Yukihiro Matsumoto.
JDeveloper 10g and JavaServer Faces: High-Performance UIs on the Web Avrom Roy-Faderman Senior Programmer May, 2006.
CISC474 - JavaScript 03/02/2011. Some Background… Great JavaScript Guides: –
JSP Java Server Pages Softsmith Infotech.
Codeigniter is an open source web application. It occupies a very small amount of space in the memory and is most useful for developers who aim to develop.
Data File Access API : Under the Hood Simon Horwith CTO Etrilogy Ltd.
MVC & ActiveRecord by Christian Mohr & Mohamed Souiai.
Client Scripting1 Internet Systems Design. Client Scripting2 n “A scripting language is a programming language that is used to manipulate, customize,
1 Dr Alexiei Dingli Web Science Stream Introducing Rails.
Ruby on Rails Your first app. Rails files app/ Contains the controllers, models, views and assets for your application. You’ll focus on this folder for.
CMPS 211 JavaScript Topic 1 JavaScript Syntax. 2Outline Goals and Objectives Goals and Objectives Chapter Headlines Chapter Headlines Introduction Introduction.
XRules An XML Business Rules Language Introduction Copyright © Waleed Abdulla All rights reserved. August 2004.
Lecture 11 Rails Topics SaaSSaaS Readings: SaaS book Ch February CSCE 740 Software Engineering.
The Active Record Paradigm Databases in Database-Centric Web Site Development.
Introduction to JavaServer Pages. 2 JSP and Servlet Limitations of servlet  It’s inaccessible to non-programmers JSP is a complement to servlet  focuses.
Object-to-Relational Mapping: The Crossing Chasms Pattern and Implementation Considerations Use of Meta Data in the Java Persistence Layer Presented by.
Selenium and Selenium on Rails. Agenda  Overview of Selenium Simple Selenium Tests Selenium IDE  Overview of Selenium on Rails  Problems with Selenium.
Routes & REST & URL-helpers & validations & filters
Ruby/Ruby on Rails Yasushi Osonoi Open Dream corporation
RUBY ON RAILS (RoR) Ishwor Khadka. Why Ruby on Rails?
JAVA BEANS JSP - Standard Tag Library (JSTL) JAVA Enterprise Edition.
Portals: Architecture & Best Practices Greg Hinkle February 2005.
 Web pages originally static  Page is delivered exactly as stored on server  Same information displayed for all users, from all contexts  Dynamic.
Rich Internet Applications 2. Core JavaScript. The importance of JavaScript Many choices open to the developer for server-side Can choose server technology.
IS2803 Developing Multimedia Applications for Business (Part 2) Lecture 2: Introduction to IS2803 Rob Gleasure
Rails and routing INFO 2310: Topics in Web Design and Programming.
Dr. Abdullah Almutairi Spring PHP is a server scripting language, and a powerful tool for making dynamic and interactive Web pages. PHP is a widely-used,
Python: Building Geoprocessing Tools David Wynne, Ghislain Prince.
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.
CGS 3066: Web Programming and Design Spring 2016 PHP.
1 Rails for the Ruby-Impaired John Paul Ashenfelter CTO/Transitionpoint.
Reactor An ORM framework for ColdFusion Presentation By: Doug Hughes
Presented by Alexey Vedishchev Developing Web-applications with Grails framework American University of Nigeria, 2016 Part VI: Mapping URLs.
NetBeans & Ruby David Botterill Software Engineer Global Technology Manager - Campus Ambassador Program Sun Microsystems, Inc.
JRuby on Rails Presenter Name
Cake PHP – OOPS approach for PHP
JRuby on Rails Brian Leonard ブライアン レオナルド
Managing State Chapter 13.
Selenium and Selenium on Rails
MVC Architecture, Symfony Framework for PHP Web Apps
PHP Introduction.
Ruby on Rails by Manik Juneja
Ruby on Rails by Manik Juneja
Tutorial 6 PHP & MySQL Li Xu
PHP an introduction.
Presentation transcript:

Ruby on Rails Presenter: Michael Mayer 30-March-2006 Network RPI This presentation was adapted from a ThoughtWise presentation By Obie Fernandez; originally presented on 10-March-2005.

Presentation Agenda Very brief overview of Ruby Description of Rails framework Questions and Answers Rails demo (if time allows…)

Why Ruby? Write understandable code in few lines – “meta- programming” Free (Very open license) Extensible Truly object oriented – there are no primitives Why not Ruby? Lack of support for casting Lack of documentation Relatively small community

Some Coding Conventions Method Chaining print array.uniq.sort.reverse (now that’s meta-programming!) Method Names include ! and ? ary.sort! Iterators and Blocks vs. Loops files.each { |file| process(file) } Case usage: Class names begin with a Capital letter Constants are ALL_CAPS Everything else - method call or a local variable under_score instead of camelCase

Enough About Ruby! Time to talk about Ruby on Rails!

Rails in a Nutshell It is a rapid development framework; a framework is simply a set of best practices and abstractions often accompanied by automation scripts that, in combination, make SW development with specific technologies easier. Create database-driven web applications according to the Model-View- Control pattern of separation. Favors Convention over Configuration! Mostly written by David H. Hannson A 37signals.com principal Maintained by an active OS community!

Rails Architecture

Model – View – Controller Model classes are the "smart" domain objects (e.g. Product) that hold business logic and know how to persist themselves to a database Views are HTML/XML templates Controllers handle incoming requests (e.g. Update Product) by manipulating the model and directing data to the view

ActiveRecord API Object/Relational Mapping Framework Model classes use this API Automatic mapping between columns and class attributes Declarative configuration via macros Dynamic finders Associations, Aggregations, Tree and List Behaviors Locking Validation rules Et cetera…

ActiveRecord Associations Macro-like class methods for tying objects together through foreign keys Each adds a number of methods to the class In combination with migrations, allows your database to be DBMS agnostic

ActionController API Controllers defined as classes that execute and then either render a template or redirects An action is a public method on the controller Getting data in and out of controllers Request parameters available in hash (and can be multidimensional) Web session exposed hash Cookies exposed hash Redirect scope provided hash (unique to Rails)

From Controller to View Rails gives you many rendering options… Default template rendering – follow naming conventions and magic happens Explicitly render to particular action Redirect to another action Render a string response (or no response)

Approaches to View Templating ERB – Embedded Ruby Similar to JSP’s <% and <%= syntax or PHP’s <? syntax Easy to learn and teach to designers Execute in scope of controller Denoted with.rhtml extension XmlMarkup – Programmatic View Construction Great for writing xml content Denoted with.rxml extension Embeddable in ERB templates

ERB Example

XmlMarkup Example

Layouts and Partials Templates in app/views/layouts/ with the same name as a controller will be automatically set as that controller’s layout unless explicitly told otherwise Partials are sub-templates that render a single object Partial template files follow convention Easy API support for rendering collections of partials.

The Quest for Pretty URLs The responsibility of URL parsing is handled by Rails itself. Why? Not all webservers support rewriting Allows Rails to function “out of the box” on almost all webservers Facilitates definition of custom URLs Linked to URL helper methods such as url_for, link_to, and redirect_to Routing rules defined in config/routes.rb

routes.rb ActionController::Routing::Routes.draw do |map| # Priority based on creation: first created -> highest priority # Keep in mind you can assign values other than :controller and :action # You can have the root of your site routed by hooking up '' # just remember to delete public/index.html. map.connect '', :controller => "bakery" map.connect 'query/:guid', :controller => “global", :action=>"query" # Allow downloading Web Service WSDL as a file with an extension map.connect ':controller/service.wsdl', :action => 'wsdl' map.connect ':controller/:action/:id’ # Default end

Rails to the Rescue Actions that fail to perform as expected throw exceptions Exceptions can be rescued… for public view (with a nice user-friendly explanation) for developers view (with tons of debugging information) By default, requests from localhost get developers view

Rake Ruby’s Build System Familiar to Ant users Your build file is a written in Ruby Basic build script provided with Rails project

The Rails Community The developer community around Rails is very helpful and excited Rails Wiki - Rails Mailing List – very active IRC – Get instant answers to most questions. David and other Rails commiters are all regularly present

What did I leave out? ActionMailer API ActionWebService API ActiveSupport API Scaffolding Scripts and Generators Webrick web server Et cetera…

Questions / Comments? Thanks for listening! Feel free to me. I am one of your TAs after all… :] Original presentation: n%20Rails.ppt

Demo Time to see some code!