CS 142 Lecture Notes: Rails Controllers and ViewsSlide 1 Simple Rails Template <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

Slides:



Advertisements
Similar presentations
The Important Thing About By. The Important Thing About ******** The important thing about ***** is *****. It is true s/he can *****, *****, and *****.
Advertisements

Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 15 Introduction to Rails.
CS 142 Lecture Notes: FormsSlide 1 Simple Form Product: Price:
CS 142 Lecture Notes: FormsSlide 1 Simple Form Product: Price:
David Evans CS150: Computer Science University of Virginia Computer Science Lecture 26: Proving Uncomputability Visualization.
CS107 Introduction to Computer Science Lecture 3, 4 An Introduction to Algorithms: Loops.
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.
CS 142 Lecture Notes: FormsSlide 1 Simple Form Value1: Value2:
XML and Ruby on Rails Jennifer Andrews LIS 531F April 25,2007.
15-Jun-15 Rails and Ajax. HTML Forms The... tag encloses form elements (and usually includes other HTML as well) The arguments to form tell what to do.
CS 683 Emerging Technologies Fall Semester, 2005 Doc 21 Rails Intro Nov 10, 2005 Copyright ©, All rights reserved SDSU & Roger Whitney, 5500 Campanile.
CS 117 Spring 2002 Review for Exam 2 March 6, 2002 open book, 1 page of notes.
CS 142 Lecture Notes: FormsSlide 1 Simple Form Value1: Value2:
UFCEKG-20-2 Data, Schemas & Applications Lecture 4 Server Side Scripting & PHP.
The Ruby Programming Language
Cloud computing lectures: Programming with Google App Engine Keke Chen.
JavaScript Lecture 6 Rachel A Ober
More on Functions (Part 2) Intro to Computer Science CS1510, Section 2 Dr. Sarah Diesburg.
.Net and Web Services Security CS795. Web Services A web application Does not have a user interface (as a traditional web application); instead, it exposes.
1 st Semester Module4-1 Iteration statement - while อภิรักษ์ จันทร์สร้าง Aphirak Jansang Computer.
Logic Disjunction A disjunction is a compound statement formed by combining two simple sentences using the word “OR”. A disjunction is true when at.
Lecture 3 Decisions (Conditionals). One of the essential features of computer programs is their ability to make decisions. Like a train that changes tracks.
Barbara White School of Information Technology XHTML template Saving files in Notepad.
Functions. Built-in functions You’ve used several functions already >>> len("ATGGTCA")‏ 7 >>> abs(-6)‏ 6 >>> float("3.1415")‏ >>>
Python uses boolean variables to evaluate conditions. The boolean values True and False are returned when an expression is compared or evaluated.
Chapter 15 © 2013 by Pearson Overview of Rails - Rails is a development framework for Web-based applications - Based on MVC architecture for applications.
Create, Update and Delete Carol Wolf Computer Science.
ITEC 109 Lecture 11 While loops. while loops Review Choices –1 st –2 nd to ?th –Last What happens if you only use ifs? Can you have just an else by itself?
CS 683 Emerging Technologies Fall Semester, 2005 Doc 26 Rails Miscellaneous Dec 1, 2005 Copyright ©, All rights reserved SDSU & Roger Whitney, 5500.
A: A: double “4” A: “34” 4.
CS 142 Lecture Notes: FormsSlide 1 Simple Form Product: Price:
AJAX in Ruby-on-Rails. Ruby on Rails and AJAX AJAX can be done with just Javascript Easier if you use libraries –Prototype –SAJAX –jQuery Libraries only.
CS 160 and CMPE/SE 131 Software Engineering February 9 Class Meeting Department of Computer Science Department of Computer Engineering San José State University.
The Controller Carol Wolf Computer Science. Rails generate commands  Using the generate command, you can create a number of useful objects.  Rails:
1 9/26/05CS150 Introduction to Computer Science 1 Life is Full of Alternatives.
1 st Semester Module4-1 Iteration statement - while อภิรักษ์ จันทร์สร้าง Aphirak Jansang Computer.
CS 160 and CMPE/SE 131 Software Engineering February 11 Class Meeting Department of Computer Science Department of Computer Engineering San José State.
Python: Structured Programming Damian Gordon. Structured Programming Remember the modularised version of the prime number checking program:
Sudeshna Sarkar, IIT Kharagpur 1 Programming and Data Structure Sudeshna Sarkar Lecture 3.
CS1301 Introduction To Computer Programming (11-12 Semester B) Lecture Exercise (Wk8) Q.1 Write the code that asks the user.
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.
More on Functions (Part 2) Intro to Computer Science CS1510, Section 2 Dr. Sarah Diesburg.
CompSci 101 Introduction to Computer Science February 5, 2015 Prof. Rodger Lecture given by Elizabeth Dowd compsci101 spring151.
Hello Educational presentation.
CS 140 Lecture Notes: Virtual Memory
Web Systems & Technologies
More on Functions (Part 2)
Intelligent Agents Lecture 3-2 October 14th, 1999 CS250 Lecture 2-1
Product Training Program
Presented by, Mr. Satish Pise
Crystal Template - Trial Version.
Factors, multiple, primes: Factors from prime factors
Saving a .html file in NotePad
String Encodings and Penny Math
CS 142 Lecture Notes: Rails Controllers and Views
CS 142 Lecture Notes: Cookies
Model – View – Controller Pattern
HTTP Request Method URL Protocol Version GET /index.html HTTP/1.1
Factors, multiple, primes: Prime factors
Chapter 15 Introduction to Rails.
CS105 Introduction to Computer Concepts
CS 142 Lecture Notes: Rails Controllers and Views
More on Functions (Part 2)
More on Functions (Part 2)
Activity: Prime Path Coverage CS 4501 / 6501 Software Testing
String Encodings and Penny Math
Compiler Construction
Uniform Resource Locators (URLs)
Factors, multiple, primes: Multiples
Presentation transcript:

CS 142 Lecture Notes: Rails Controllers and ViewsSlide 1 Simple Rails Template <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" " <html xmlns=" xml:lang="en" lang="en"> Hello, User This page was fetched at

CS 142 Lecture Notes: Rails Controllers and ViewsSlide 2 Control Structures in Templates ?xml version="1.0" encoding="utf-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" " Rails Parameters The params hash contains the following values: :

CS 142 Lecture Notes: Rails Controllers and ViewsSlide 3 Control Structures, cont’d... :... :... x: 44 y: 92 action: showParams controller: rails_intro... x: 44 y: 92 action: showParams controller: rails_intro... Template: HTML:

CS 142 Lecture Notes: Rails Controllers and ViewsSlide 4 Controller: Compute Primes class RailsIntroController < ApplicationController def show_primes if params[:count] != nil then count = params[:count].to_i() else count = 10 = [] candidate = 2 < count is_prime = do |prime| if (candidate % prime) == 0 then is_prime = false break end if is_prime << candidate end candidate += 1 end Query value determines # primes to compute Fill array with prime numbers

CS 142 Lecture Notes: Rails Controllers and ViewsSlide 5 Template to Display Primes Prime Numbers The first prime numbers are: Prime Numbers ">

Directory Structure CS 142 Lecture Notes: Rails Controllers and ViewsSlide 6 app rails_intro views models controllers rails_intro_controller.rb student_controller.rb hello.html.erb show_params.html.erb show_primes.html.erb student stylesheets main.css db migrate assets javascripts images

CS 142 Lecture Notes: Rails Controllers and ViewsSlide 7 Layouts <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" " <html xmlns=" xml:lang="en" lang="en"> app/views/layouts/application.html.erb: This page was fetched at app/views/rails_intro/hello.html.erb:

CS 140 Lecture Notes: File SystemsSlide 8