Associations: mechanics (ESaaS 5.3)"

Size: px
Start display at page:

Download "Associations: mechanics (ESaaS 5.3)""

Transcription

1 Associations: mechanics (ESaaS 5.3)" Armando Fox" 2013 Armando Fox & David Patterson, all rights reserved

2 How does it work?" Models must have attribute for foreign key of owning object" e.g., movie_id in reviews table" ActiveRecord manages this field in both database & in-memory AR object" Don t manage it yourself!" Harder to read" May break if database schema doesn t follow Rails conventions"

3 Rails Cookery #4 " To add a one-to-many association:" 1. Add has_many to owning model and belongs_to to owned model" 2. Create migration to add foreign key to owned side that references owning side" 3. Apply migration" 4. rake db:test:prepare to regenerate test database schema"

4 Suppose we have setup the foreign key movie_id in reviews table. If we then add has_many :reviews to Movie, but forget to put belongs_to :movie in Review, what happens?" " We can say movie.reviews, but review.movie won't work" " We will get a database error when trying to save a Review " " We will have no way of determining which movie a given review is associated with" " All of the above" 4"

5 Through-Associations (ESaaS 5.4)" Armando Fox" 2013 Armando Fox & David Patterson, all rights reserved

6 Many-to-many associations" Scenario: Moviegoers rate Movies" a moviegoer can have many reviews" but a movie can also have many reviews" Why can t we use has_many & belongs_to?" Solution: create a new AR model to model the multiple association!

7 Many-to-many" moviegoer" id" reviews" moviegoer_id" movie_id" number" movies" id"..." moviegoer: has_many :reviews movie: has_many :reviews review: belongs_to :moviegoer belongs_to :movie How to get all movies reviewed by some moviegoer? "

8 has_many :through moviegoers" id" reviews" moviegoer_id" movie_id"..." movies" id"..." moviegoer: has_many :reviews has_many :movies, :through => :reviews movie: has_many :reviews has_many :moviegoers, :through => :reviews" reviews: belongs_to :moviegoer belongs_to :movie

9 Now you can do:" # movies rated by # users who rated this movie My potato scores for R-rated { r r.movie.rating == 'R' }

10 has_many :through moviegoers" id" reviews" moviegoer_id" movie_id"..." movies" SELECT * FROM movies JOIN moviegoers ON reviews.moviegoer_id = moviegoers.id JOIN movies ON reviews.movie_id = movies.id

11 Which of these, if any, is NOT a correct way of saving a new association, given m is an existing movie:" Review.create!(:movie_id=>m.id, :potatoes=>5) r = m.reviews.build(:potatoes => 5) r.save! m.reviews << Review.new(:potatoes=>5) m.save! All will work" 11"

12 Has and belongs to many (ESaaS 5.4)" Armando Fox" 2013 Armando Fox & David Patterson, all rights reserved

13 A shortcut: has and belongs to many (habtm)" join tables express a relationship between existing model tables using FKs" Join table has no primary key! because there s no object being represented!" movie has_and_belongs_to_many :genres genre has_and_belongs_to_many << Genre.find_by_name('scifi') genres" id" description" genres_movies" genre_id" movie_id" movies" id" name"...etc."

14 Rules of Thumb" if you can conceive of things as different real-world objects, they should probably be distinct models linked through an association" if you don't need to represent any other aspect of a M-M relationship, use habtm" otherwise, use has_many :through 14 14"

15 HABTM Naming Conventions" " M-M relationship naming convention: " if a Bar " has_and_belongs_to_many :foos" then a Foo" has_and_belongs_to_many :bars" and the database table is the " plural AR names in alphabetical order" bars_foos" 15

16 We want to model students having appointments with faculty members. Our model would include which relationships:" Faculty has-many appointments, Student has-many appointments" Faculty HABTM Students," Students HABTM Faculty" Faculty belongs-to appointment," Student belongs-to appointment" Faculty has-many appointments, " through Students" 16"

17 RESTful Routes for Associations (ESaaS 5.5)" Armando Fox" 2013 Armando Fox & David Patterson, all rights reserved

18 Creating/updating throughassociations" When creating a new review, how to keep track of the movie and moviegoer with whom it will be associated?" Need this info at creation time" But route helpers like new_movie_path (provided by resources :movies in routes file) only carry around the ID of the model itself"

19 Nested RESTful Routes" " in config/routes.rb: resources :movies becomes resources :movies do resources :reviews end " Nested Route: access reviews by going through a movie"

20 Nested RESTful Routes" available as params[:movie_id] available as params[:id]

21 ReviewsController#create # POST /movies/1/reviews # POST /movies/1/reviews.xml def create # movie_id because of nested = Movie.find(params[:movie_id]) # build sets the movie_id foreign key flash[:notice] = 'Review successfully created.' redirect_to(movie_reviews_path(@movie)) else render :action => 'new' end end

22 ReviewsController#new" # GET /movies/1/reviews/new def new # movie_id because of nested = Movie.find(params[:movie_id]) # new sets movie_id foreign key = = end Another possibility: do it in a before-filter " before_filter :lookup_movie def = Movie.find_by_id(params[:movie_id]) redirect_to movies_path, :flash => {:alert => "movie_id not in params"} end

23 Views" %h1 Edit = form_tag movie_review_path(@movie,@review), :method => :put do f...will f create form fields for a Movie or a Review? " = f.submit "Update Info" = link_to 'All reviews for this movie', movie_reviews_path(@movie) Remember, these are for convenience. Invariant is: review when created or edited must be associated with a movie."

24 If we also have moviegoer has_many reviews," can we use moviegoer_review_path() as a helper?" " Yes, it should work as-is because of convention over configuration" Yes, but we must declare reviews as a nested resource of moviegoers in routes.rb No, because there can be only one RESTful route to any particular resource" No, because having more than one through-association involving Reviews would lead to ambiguity" 24"

25 DRYing Out Queries with Reusable Scopes (ESaaS 5.6)" Armando Fox" 2013 Armando Fox & David Patterson, all rights reserved

26 Customizing associations with declarative scopes" Movies appropriate for kids?" Movies with at least N reviews?" Movies with at least average review of N?" Movies recently reviewed?" Combinations of these?!

27 Scopes Can Be Stacked " Movie.for_kids.with_good_reviews(3) Movie.with_many_fans.recently_reviewed Scopes are evaluated lazily!"

28 1 # in controller: 2 def good_movies_for_kids = Movie.for_kids.with_good_reviews(3) 4 end 5 # in view: 6 do movie 7 %p= pretty_print(movie) Where do database queries happen?" "Line 3 only" Lines 6-7 only" Line 3 AND lines 6-7" Depends on return value of for_kids" 28"

29 Associations wrap-up (ESaaS )" Armando Fox" 2013 Armando Fox & David Patterson, all rights reserved

30 Associations wrap-up" Associations are part of application architecture" provides high-level, reusable association constructs that manipulate RDBMS foreign keys" Mix-ins allow Associations mechanisms to work with any ActiveRecord subclass" Proxy methods provide Enumerable-like behaviors" A many-fold association quacks like an Enumerable" Proxy methods are an example of a design pattern" Nested routes help you maintain associations RESTfully but they re optional, and not magic"

31 Elaboration: DataMapper" Data Mapper associates separate mapper with each model" Idea: keep mapping independent of particular data store used => works with more types of databases" Used by Google AppEngine" Con: can t exploit RDBMS features to simplify complex queries & relationships" 31"

32 Referential Integrity" What if we delete a movie with reviews?" movie_id field of those reviews then refers to nonexistent primary key" another reason primary keys are never recycled" Various possibilities depending on app..." delete those reviews? has_many :reviews, :dependent => :destroy make reviews orphaned? (no owner)" has_many :reviews, :dependent => :nullify Can also use lifecycle callbacks to do other things (eg, merging)"

33 Testing Referential Integrity" it "should nuke reviews when movie deleted" lambda { Review.find(review_id) }.should raise_error(activerecord::recordnotfound)

34 Advanced Topics" Single-Table Inheritance (STI) & Polymorphic Associations" Self-referential has_many :through" Many declarative options on manipulating associations (like validations) " To learn (much) more:" association_basics.html " The Rails Way, Chapter 9"

35 If using the DataMapper pattern and you want to do one-to-many associations, you can expect:" " to have to write the association methods yourself" Better scalability" Worse scalability" All of the above are possible" 35"

A shortcut: has and belongs to many (habtm)

A shortcut: has and belongs to many (habtm) A shortcut: has and belongs to many (habtm) join tables express a relationship between existing model tables using FKs Join table has no primary key because there s no object being represented! ttvgtnlx

More information

Validations vs. Filters

Validations vs. Filters Validations vs. Filters Advice (DRYness) Validation Filter Check invariants on model Check conditions for allowing controller action to run Pointcut AR model lifecycle hooks Before and/or after any public

More information

DRYing Out MVC (ESaaS 5.1)"

DRYing Out MVC (ESaaS 5.1) DRYing Out MVC (ESaaS 5.1)" Armando Fox" 2013 Armando Fox & David Patterson, all rights reserved Don t Repeat Yourself but how?" Goal: enforce that movie names must be less than 40 characters" Call a check

More information

CS169.1x Lecture 6: Basic Rails" Fall 2012"

CS169.1x Lecture 6: Basic Rails Fall 2012 CS169.1x Lecture 6: Basic Rails" Fall 2012" 1" The Database is Golden Contains valuable customer data don t want to test your app on that! Rails solution: development, production and test environments

More information

Caching: Improving Rendering Time & Database Performance (ESaaS 12.6)! 2013 Armando Fox & David Patterson, all rights reserved

Caching: Improving Rendering Time & Database Performance (ESaaS 12.6)! 2013 Armando Fox & David Patterson, all rights reserved Caching: Improving Rendering Time & Database Performance (ESaaS 12.6)! 2013 Armando Fox & David Patterson, all rights reserved The fastest database is the one you don t use" Caching: Avoid touching database

More information

Rails: MVC in action

Rails: MVC in action Ruby on Rails Basic Facts 1. Rails is a web application framework built upon, and written in, the Ruby programming language. 2. Open source 3. Easy to learn; difficult to master. 4. Fun (and a time-saver)!

More information

Dependency Injection (ESaaS 11.6)! 2013 Armando Fox & David Patterson, all rights reserved

Dependency Injection (ESaaS 11.6)! 2013 Armando Fox & David Patterson, all rights reserved Dependency Injection (ESaaS 11.6)! 2013 Armando Fox & David Patterson, all rights reserved Dependency Inversion & Dependency Injection" Problem: a depends on b, but b interface & implementation can change,

More information

COM401 Software Engineering Laboratory

COM401 Software Engineering Laboratory Computer Engineering Department COM401 Software Engineering Laboratory November 04, 2014 LAB-3: Rails Introduction Time: 2 lab hours Objectives: Practice with Ruby Symbols Routes MVC pattern CRUD operations

More information

Lecture 6. Active Record Associations 1 / 34

Lecture 6. Active Record Associations 1 / 34 Lecture 6 Active Record Associations 1 / 34 Midterm Course Evaluations https://goo.gl/forms/0ddvh2gqox60fwm13 2 / 34 Learn HTML You're going to be writing your own views in the next HW Make sure to familiarise

More information

Active Record Associations

Active Record Associations Active Record Associations January 13, 2015 This guide covers the association features of Active Record. After reading this guide, you will know: How to declare associations between Active Record models.

More information

Lecture 6. Active Record Associations 1 / 30

Lecture 6. Active Record Associations 1 / 30 Lecture 6 Active Record Associations 1 / 30 Homeworks 4 & 5 Homework 4 was graded Homework 5 was due last night Any questions? 2 / 30 Learn HTML Time's almost up! You're going to be writing your own views

More information

Rails: Associations and Validation

Rails: Associations and Validation Rails: Associations and Validation Computer Science and Engineering College of Engineering The Ohio State University Lecture 17 Schemas, Migrations, Models migrations models database.yml db:migrate db:create

More information

Web System Development with Ruby on Rails

Web System Development with Ruby on Rails Web System Development with Ruby on Rails Day 11(6/Dec/2012) File uploading and Image Display Today's Theme p Upload image files to the database, and let Memopad store the image file. p Try some other

More information

Authentication in Rails

Authentication in Rails Authentication in Rails Aaron Mulder CTO Chariot Solutions Philly on Rails, October 2007 1 Agenda The problem Plugins in Rails, and the (many) solutions acts_as_authenticated Generated Code Custom Code

More information

Where we are. For example. Extensions. Authorization and Testing

Where we are. For example. Extensions. Authorization and Testing Where we are Authorization and Testing Last time: We added the ability of users to log in, and made sure that we treated their passwords in a secure fashion. INFO 2310: Topics in Web Design and Programming

More information

Databases - Have it your way

Databases - Have it your way Databases - Have it your way Frederick Cheung - kgb fred@texperts.com http://www.spacevatican.org 1 kgb Operates a number of Directory Enquiry type products in several countries Runs the 542542 Ask Us

More information

Object Relational Mapping. Kenneth M. Anderson University of Colorado, Boulder Lecture 29 CSCI 4448/ /06/11

Object Relational Mapping. Kenneth M. Anderson University of Colorado, Boulder Lecture 29 CSCI 4448/ /06/11 Object Relational Mapping Kenneth M. Anderson University of Colorado, Boulder Lecture 29 CSCI 4448/5448 12/06/11 1 Credit where Credit is Due The slides that cover Hibernate and JPA were developed by Aaron

More information

Lecture 8. Validations & Sessions 1 / 41

Lecture 8. Validations & Sessions 1 / 41 Lecture 8 Validations & Sessions 1 / 41 Advanced Active Record 2 / 41 More Complex Queries Arel provides us with a number of methods to query our database tables So far, we've only used find which limits

More information

iflame INSTITUTE OF TECHNOLOGY

iflame INSTITUTE OF TECHNOLOGY Web Development Ruby On Rails Duration: 3.5 Month Course Overview Ruby On Rails 4.0 Training From Iflame Allows You To Build Full Featured, High Quality, Object Oriented Web Apps. Ruby On Rails Is A Full

More information

Overview of the Ruby Language. By Ron Haley

Overview of the Ruby Language. By Ron Haley Overview of the Ruby Language By Ron Haley Outline Ruby About Ruby Installation Basics Ruby Conventions Arrays and Hashes Symbols Control Structures Regular Expressions Class vs. Module Blocks, Procs,

More information

Courslets, a golf improvement web service. Peter Battaglia

Courslets, a golf improvement web service. Peter Battaglia Courslets, a golf improvement web service Peter Battaglia Discussion Project Overview Design and Technologies Utilized Rails and REST URLs, URLs, URLs Rails and Web Services What s s exposed as a service?

More information

JavaScript: the Big Picture

JavaScript: the Big Picture JavaScript had to look like Java only less so be Java's dumb kid brother or boy-hostage sidekick. Plus, I had to be done in ten days or something worse than JavaScript would have happened.! JavaScript:

More information

Software Engineering 2 (SWT2) Chapter 2: Introduction into Ruby on Rails

Software Engineering 2 (SWT2) Chapter 2: Introduction into Ruby on Rails Software Engineering 2 (SWT2) Chapter 2: Introduction into Ruby on Rails Agenda 2 Ruby & Ruby on Rails What is Ruby on Rails? A few words about Ruby Core components RESTful architecture Active Record Your

More information

CSCI-2320 Web Programming: Ruby on Rails

CSCI-2320 Web Programming: Ruby on Rails CSCI-2320 Web Programming: Ruby on Rails Mohammad T. Irfan Plan u Model-View-Controller (MVC) framework of web programming u Ruby on Rails 1 Ruby on Rails u Developed by David Hansson released 2004 u MVC

More information

Microsoft Office Access 2007: Intermediate Course 01 Relational Databases

Microsoft Office Access 2007: Intermediate Course 01 Relational Databases Microsoft Office Access 2007: Intermediate Course 01 Relational Databases Slide 1 Relational Databases Course objectives Normalize tables Set relationships between tables Implement referential integrity

More information

Typical PHP Code Everything shoved into one file. Not Good!

Typical PHP Code Everything shoved into one file. Not Good! MVC in Trax Typical PHP Code Everything shoved into one file. Not Good!

More information

Rails + Legacy Databases Brian Hogan - RailsConf 2009 twitter: bphogan IRC: hoganbp

Rails + Legacy Databases Brian Hogan - RailsConf 2009 twitter: bphogan IRC: hoganbp Rails + Legacy Databases Brian Hogan - RailsConf 2009 twitter: bphogan IRC: hoganbp So the main thing I want you to take away from this talk is... Please don t do it! Questions? Just kidding. The point

More information

Web System Development with Ruby on Rails

Web System Development with Ruby on Rails Web System Development with Ruby on Rails Day 7(8/Nov/2012) Relational Database Today's Theme Learn Relation Structure in Relational Database Understand how to describe the relational structure Add new

More information

Choose Your Battles and LetIt::REST. Hampton Catlin and Jeffrey Hardy

Choose Your Battles and LetIt::REST. Hampton Catlin and Jeffrey Hardy Choose Your Battles and LetIt::REST Hampton Catlin and Jeffrey Hardy Obligatory Resume 50 years of Rails experience PHDs from MIT Founded the Dharma Initiative Invented Haml, Scribbish, Sass, ASCII, Ruby,

More information

Rails 4 Quickly. Bala Paranj

Rails 4 Quickly. Bala Paranj Rails 4 Quickly Bala Paranj 1 About Author Bala Paranj has a Master s degree in Electrical Engineering from The Wichita State University. He has over 15 years of experience in the software industry. He

More information

Events & Callbacks (ESaaS 6.5)! 2013 Armando Fox & David Patterson, all rights reserved

Events & Callbacks (ESaaS 6.5)! 2013 Armando Fox & David Patterson, all rights reserved Events & Callbacks (ESaaS 6.5)! 2013 Armando Fox & David Patterson, all rights reserved Events" What: occurrences that affect the user interface" User interacts with a page element" Previously-set timer

More information

CSCI 1100L: Topics in Computing Lab Lab 07: Microsoft Access (Databases) Part I: Movie review database.

CSCI 1100L: Topics in Computing Lab Lab 07: Microsoft Access (Databases) Part I: Movie review database. CSCI 1100L: Topics in Computing Lab Lab 07: Microsoft Access (Databases) Purpose: The purpose of this lab is to introduce you to the basics of creating a database and writing SQL (Structured Query Language)

More information

Rails Guide. MVC Architecture. Migrations. Hey, thanks a lot for picking up this guide!

Rails Guide. MVC Architecture. Migrations. Hey, thanks a lot for picking up this guide! Rails Guide Hey, thanks a lot for picking up this guide! I created this guide as a quick reference for when you are working on your projects, so you can quickly find what you need & keep going. Hope it

More information

Principles of Ruby Applica3on Design. Dean Wampler Senior Mentor and Consultant Object Mentor, Inc. Chicago, IL

Principles of Ruby Applica3on Design. Dean Wampler Senior Mentor and Consultant Object Mentor, Inc. Chicago, IL Principles of Ruby Applica3on Design Dean Wampler Senior Mentor and Consultant Object Mentor, Inc. Chicago, IL dean@objectmentor.com 1 Get the latest version of this talk: aspectprogramming.com/papers

More information

Web Application Expectations

Web Application Expectations Effective Ruby on Rails Development Using CodeGear s Ruby IDE Shelby Sanders Principal Engineer CodeGear Copyright 2007 CodeGear. All Rights Reserved. 2007/6/14 Web Application Expectations Dynamic Static

More information

Ruby on Rails 3. Robert Crida Stuart Corbishley. Clue Technologies

Ruby on Rails 3. Robert Crida Stuart Corbishley. Clue Technologies Ruby on Rails 3 Robert Crida Stuart Corbishley Clue Technologies Topic Overview What is Rails New in Rails 3 New Project Generators MVC Active Record UJS RVM Bundler Migrations Factory Girl RSpec haml

More information

Rails Routing Roundup

Rails Routing Roundup Rails Routing Roundup Rails Routing Roundup David A. Black Ruby Power and Light, LLC http://www.rubypal.com 1 Roadmap Basics of routing system Recognition Generation Defining routes (routing rules) in

More information

Bricks Documentation. Release 1.0. Germano Guerrini

Bricks Documentation. Release 1.0. Germano Guerrini Bricks Documentation Release 1.0 Germano Guerrini January 27, 2015 Contents 1 Requirements 3 2 Contents 5 2.1 Getting Started.............................................. 5 2.2 Basic Usage...............................................

More information

Course 55197A: Microsoft SharePoint Server 2016 for the Site Owner/Power User

Course 55197A: Microsoft SharePoint Server 2016 for the Site Owner/Power User Skip to main content Course 55197A: Microsoft SharePoint Server 2016 for the Site Owner/Power User - Course details Course Outline Module 1: The Role of the Site Owner This module provides an introduction

More information

Sri Vidya College of Engineering & Technology

Sri Vidya College of Engineering & Technology UNIT I INTRODUCTION TO OOP AND FUNDAMENTALS OF JAVA 1. Define OOP. Part A Object-Oriented Programming (OOP) is a methodology or paradigm to design a program using classes and objects. It simplifies the

More information

CSE 341, Autumn 2015, Ruby Introduction Summary

CSE 341, Autumn 2015, Ruby Introduction Summary CSE 341, Autumn 2015, Ruby Introduction Summary Disclaimer: This lecture summary is not necessarily a complete substitute for atting class, reading the associated code, etc. It is designed to be a useful

More information

Chado on Rails. a framework to simplify development on the Chado schema. Justin Reese / Chris Childers

Chado on Rails. a framework to simplify development on the Chado schema. Justin Reese / Chris Childers Chado on Rails a framework to simplify development on the Chado schema Justin Reese / Chris Childers Some links: These slides: http://tinyurl.com/chadoonrails Source code, have a look: svn co http://chadoonrails.rubyforge.org/svn/trunk

More information

Here are some figures to consider while answering the following questions.

Here are some figures to consider while answering the following questions. Here are some figures to consider while answering the following questions. Figure 1. Example page from Music Catalog web app. Figure 2. config/routes.rb Figure 3. Output of rake routes command. Figure

More information

Rails: Associations and Validation

Rails: Associations and Validation Rails: Associations and Validation Computer Science and Engineering College of Engineering The Ohio State University Lecture 26 Schemas, Migrations, Models migrations models database.yml db:migrate db:create

More information

step is to see how C++ implements type polymorphism, and this Exploration starts you on that journey.

step is to see how C++ implements type polymorphism, and this Exploration starts you on that journey. EXPLORATION 36 Virtual Functions Deriving classes is fun, but there s not a lot you can do with them at least, not yet. The next step is to see how C++ implements type polymorphism, and this Exploration

More information

Functions!!! Why functions? Functions provide good way to design systems!

Functions!!! Why functions? Functions provide good way to design systems! Functions!!! Why functions? Functions provide good way to design systems! Coding Design! DRY principle - Don't Repeat Yourself! Loops help with this! Functions/procedures/modules help even more! Modular

More information

Ruby on Rails 3 March 14th, 2011 Ken Li Allison Pon Kyra Leimert Matt Delaney Edward Bassett

Ruby on Rails 3 March 14th, 2011 Ken Li Allison Pon Kyra Leimert Matt Delaney Edward Bassett CMPUT 410 Ruby on Rails 3 March 14th, 2011 Ken Li Allison Pon Kyra Leimert Matt Delaney Edward Bassett Introduction - What is Ruby on Rails? Ruby on Rails is an open source web application development

More information

CS61A Notes Disc 11: Streams Streaming Along

CS61A Notes Disc 11: Streams Streaming Along CS61A Notes Disc 11: Streams Streaming Along syntax in lecture and in the book, so I will not dwell on that. Suffice it to say, streams is one of the most mysterious topics in CS61A, trust than whatever

More information

Lecture 4. Ruby on Rails 1 / 49

Lecture 4. Ruby on Rails 1 / 49 Lecture 4 Ruby on Rails 1 / 49 Client-Server Model 2 / 49 What is it? A client (e.g. web browser, phone, computer, etc.) sends a request to a server Request is an HTTP request Stands for HyperText Transfer

More information

CSCI 585 Database Systems Prof. Dennis McLeod. Sample Midterm Exam

CSCI 585 Database Systems Prof. Dennis McLeod. Sample Midterm Exam CSCI 585 Database Systems Prof. Dennis McLeod Sample Midterm Exam The purpose of this sample exam is to show the style of questions the exams will contain. It is not an indication of scope of topic coverage

More information

User Interaction: jquery

User Interaction: jquery User Interaction: jquery Assoc. Professor Donald J. Patterson INF 133 Fall 2012 1 jquery A JavaScript Library Cross-browser Free (beer & speech) It supports manipulating HTML elements (DOM) animations

More information

MongoDB Schema Design for. David Murphy MongoDB Practice Manager - Percona

MongoDB Schema Design for. David Murphy MongoDB Practice Manager - Percona MongoDB Schema Design for the Click "Dynamic to edit Master Schema" title World style David Murphy MongoDB Practice Manager - Percona Who is this Person and What Does He Know? Former MongoDB Master Former

More information

Chapter 1 SQL and Data

Chapter 1 SQL and Data Chapter 1 SQL and Data What is SQL? Structured Query Language An industry-standard language used to access & manipulate data stored in a relational database E. F. Codd, 1970 s IBM 2 What is Oracle? A relational

More information

Contents in Detail. Foreword by Xavier Noria

Contents in Detail. Foreword by Xavier Noria Contents in Detail Foreword by Xavier Noria Acknowledgments xv xvii Introduction xix Who This Book Is For................................................ xx Overview...xx Installation.... xxi Ruby, Rails,

More information

Ruby on Rails. SITC Workshop Series American University of Nigeria FALL 2017

Ruby on Rails. SITC Workshop Series American University of Nigeria FALL 2017 Ruby on Rails SITC Workshop Series American University of Nigeria FALL 2017 1 Evolution of Web Web 1.x Web 1.0: user interaction == server roundtrip Other than filling out form fields Every user interaction

More information

CMPT 354 Database Systems I

CMPT 354 Database Systems I CMPT 354 Database Systems I Chapter 2 Entity Relationship Data Modeling Data models A data model is the specifications for designing data organization in a system. Specify database schema using a data

More information

Python Basics. Lecture and Lab 5 Day Course. Python Basics

Python Basics. Lecture and Lab 5 Day Course. Python Basics Python Basics Lecture and Lab 5 Day Course Course Overview Python, is an interpreted, object-oriented, high-level language that can get work done in a hurry. A tool that can improve all professionals ability

More information

Strategies for Rapid Web Prototyping. Ruby on Rails. Clemens H. Cap

Strategies for Rapid Web Prototyping. Ruby on Rails. Clemens H. Cap Strategies for Rapid Web Prototyping Ruby on Rails Strategies for Rapid Web Prototyping DRY: Don't repeat yourself Convention over Configuration Separation of Concern Templating MVC: Model View Controler

More information

ABOUT WEB TECHNOLOGY COURSE SCOPE:

ABOUT WEB TECHNOLOGY COURSE SCOPE: ABOUT WEB TECHNOLOGY COURSE SCOPE: The booming IT business across the globe, the web has become one in every of the foremost necessary suggests that of communication nowadays and websites are the lifelines

More information

Relational Databases. Charles Severance

Relational Databases. Charles Severance Relational Databases Charles Severance Unless otherwise noted, the content of this course material is licensed under a Creative Commons Attribution 3.0 License. http://creativecommons.org/licenses/by/3.0/.

More information

Ruby on Rails Welcome. Using the exercise files

Ruby on Rails Welcome. Using the exercise files Ruby on Rails Welcome Welcome to Ruby on Rails Essential Training. In this course, we're going to learn the popular open source web development framework. We will walk through each part of the framework,

More information

Paris Documentation. Release. Jamie Matthews and Simon Holywell

Paris Documentation. Release. Jamie Matthews and Simon Holywell Paris Documentation Release Jamie Matthews and Simon Holywell Mar 21, 2017 Contents 1 Philosophy 3 2 Installation 5 2.1 Packagist................................................. 5 2.2 Download.................................................

More information

CS61A Summer 2010 George Wang, Jonathan Kotker, Seshadri Mahalingam, Eric Tzeng, Steven Tang

CS61A Summer 2010 George Wang, Jonathan Kotker, Seshadri Mahalingam, Eric Tzeng, Steven Tang CS61A Notes Week 6B: Streams Streaming Along A stream is an element and a promise to evaluate the rest of the stream. You ve already seen multiple examples of this and its syntax in lecture and in the

More information

Object-Relational Mapping

Object-Relational Mapping Object-Relational Mapping Object-Relational Mapping Software Architecture ORM Problems ORM Solutions Demo Software Architecture Part 1 Architecture Separation of Concerns A design principle that comprises

More information

App Engine: Datastore Introduction

App Engine: Datastore Introduction App Engine: Datastore Introduction Part 1 Another very useful course: https://www.udacity.com/course/developing-scalableapps-in-java--ud859 1 Topics cover in this lesson What is Datastore? Datastore and

More information

CS 169 Spring 2016, Quiz 1

CS 169 Spring 2016, Quiz 1 CS 169 Spring 2016, Quiz 1 Wednesday, Feb. 17, 2016 7 10pm 155 Dwinelle Your name: SID#: Name & signature of person on your left: Name & signature of person on your right: I certify that in accordance

More information

Object Oriented Programming: In this course we began an introduction to programming from an object-oriented approach.

Object Oriented Programming: In this course we began an introduction to programming from an object-oriented approach. CMSC 131: Chapter 28 Final Review: What you learned this semester The Big Picture Object Oriented Programming: In this course we began an introduction to programming from an object-oriented approach. Java

More information

CHAPTER 1: INTRODUCING C# 3

CHAPTER 1: INTRODUCING C# 3 INTRODUCTION xix PART I: THE OOP LANGUAGE CHAPTER 1: INTRODUCING C# 3 What Is the.net Framework? 4 What s in the.net Framework? 4 Writing Applications Using the.net Framework 5 What Is C#? 8 Applications

More information

SI Networked Computing: Storage, Communication, and Processing, Winter 2009

SI Networked Computing: Storage, Communication, and Processing, Winter 2009 University of Michigan Deep Blue deepblue.lib.umich.edu 2009-01 SI 502 - Networked Computing: Storage, Communication, and Processing, Winter 2009 Severance, Charles Severance, C. (2008, December 19). Networked

More information

Lecture 4. Ruby on Rails 1 / 52

Lecture 4. Ruby on Rails 1 / 52 Lecture 4 Ruby on Rails 1 / 52 Homeworks 2 & 3 Grades were released for homework 2 Homework 3 was due last night Everyone got a style freebie since my default setup ignores spec files and I didn't change

More information

FIT 100 More Microsoft Access and Relational Databases Creating Views with SQL

FIT 100 More Microsoft Access and Relational Databases Creating Views with SQL FIT 100 More Microsoft Access and Relational Databases Creating Views with SQL Creating Views with SQL... 1 1. Query Construction in SQL View:... 2 2. Use the QBE:... 5 3. Practice (use the QBE):... 6

More information

Ruby on Rails Installation

Ruby on Rails Installation Ruby on Rails Installation http://www.tutorialspoint.com/ruby-on-rails/rails-installation.htm This tutorial will guide you to set up a private Ruby on Rails environment in the daw server. Step 0: Login

More information

Web Application Development

Web Application Development Web Application Development Produced by David Drohan (ddrohan@wit.ie) Department of Computing & Mathematics Waterford Institute of Technology http://www.wit.ie JavaScript JAVASCRIPT FUNDAMENTALS Agenda

More information

Hellerstein/Olston. Homework 6: Database Application. beartunes. 11:59:59 PM on Wednesday, December 6 th

Hellerstein/Olston. Homework 6: Database Application. beartunes. 11:59:59 PM on Wednesday, December 6 th Homework 6: Database Application beartunes Due @ 11:59:59 PM on Wednesday, December 6 th Overview For this assignment, you ll be implementing portions of a database-backed web application using Ruby on

More information

Ruby on Rails TKK, Otto Hilska

Ruby on Rails TKK, Otto Hilska Ruby on Rails intro @ TKK, 25.5.2009 Otto Hilska 1 Today s agenda 1. The Ruby programming language 2. Ruby on Rails framework 3. An example project 2 About me Started Nodeta Oy in 2004 10+ employees always

More information

JAVA CONCEPTS Early Objects

JAVA CONCEPTS Early Objects INTERNATIONAL STUDENT VERSION JAVA CONCEPTS Early Objects Seventh Edition CAY HORSTMANN San Jose State University Wiley CONTENTS PREFACE v chapter i INTRODUCTION 1 1.1 Computer Programs 2 1.2 The Anatomy

More information

Online Entry using Ruby-on-Rails A Sport Event Management System

Online Entry using Ruby-on-Rails A Sport Event Management System Online Entry using Ruby-on-Rails A Sport Event Management System 23 rd April 2008 By Supervisor: Ian Watson Final Year Project Report - 1 - Project Title: Online entry, using Ruby on Rails A sport event

More information

CS317 File and Database Systems

CS317 File and Database Systems CS317 File and Database Systems http://dilbert.com/strips/comic/1995-10-11/ Lecture 5 More SQL and Intro to Stored Procedures September 24, 2017 Sam Siewert SQL Theory and Standards Completion of SQL in

More information

COMP19612 exam performance feedback 2014

COMP19612 exam performance feedback 2014 COMP19612 exam performance feedback 2014 (excluding section A which is multiple choice) Questions in plain font, original marking scheme in bold, additional comments in bold italic. Question 1 The students

More information

Weeks 6&7: Procedures and Parameter Passing

Weeks 6&7: Procedures and Parameter Passing CS320 Principles of Programming Languages Weeks 6&7: Procedures and Parameter Passing Jingke Li Portland State University Fall 2017 PSU CS320 Fall 17 Weeks 6&7: Procedures and Parameter Passing 1 / 45

More information

Lecture 7. Action View, Bootstrap & Deploying 1 / 40

Lecture 7. Action View, Bootstrap & Deploying 1 / 40 Lecture 7 Action View, Bootstrap & Deploying 1 / 40 Homeworks 5 & 6 Homework 5 was graded Homework 6 was due last night Any questions? 2 / 40 How would you rate the di culty of Homework 6? Vote at http://pollev.com/cis196776

More information

Cheap, Fast, and Good You can have it all with Ruby on Rails

Cheap, Fast, and Good You can have it all with Ruby on Rails Cheap, Fast, and Good You can have it all with Ruby on Rails Brian McCallister brianm@ninginc.com http://www.ning.com/ What is Ruby? Dynamic and Interpreted Strong support for OO programming Everything

More information

Database Application Architectures

Database Application Architectures Chapter 15 Database Application Architectures Database Systems(Part 2) p. 221/287 Database Applications Most users do not interact directly with a database system The DBMS is hidden behind application

More information

MASSACHUSETTS INSTITUTE OF TECHNOLOGY Database Systems: Fall 2017 Quiz I

MASSACHUSETTS INSTITUTE OF TECHNOLOGY Database Systems: Fall 2017 Quiz I Department of Electrical Engineering and Computer Science MASSACHUSETTS INSTITUTE OF TECHNOLOGY 6.830 Database Systems: Fall 2017 Quiz I There are 15 questions and 12 pages in this quiz booklet. To receive

More information

foreword to the first edition preface xxi acknowledgments xxiii about this book xxv about the cover illustration

foreword to the first edition preface xxi acknowledgments xxiii about this book xxv about the cover illustration contents foreword to the first edition preface xxi acknowledgments xxiii about this book xxv about the cover illustration xix xxxii PART 1 GETTING STARTED WITH ORM...1 1 2 Understanding object/relational

More information

Ruby on Rails. Brian McCallister Ning, Inc. Philadelphia Emerging Technology Conference 06

Ruby on Rails. Brian McCallister Ning, Inc. Philadelphia Emerging Technology Conference 06 Ruby on Rails Brian McCallister Ning, Inc. Philadelphia Emerging Technology Conference 06 Smalltalk Robert Tinney www.tinney.net + Lisp Conrad Barski www.lisperati.com + Perl O Reilly www.perl.com Without

More information

High-Level Database Models (ii)

High-Level Database Models (ii) ICS 321 Spring 2011 High-Level Database Models (ii) Asst. Prof. Lipyeow Lim Information & Computer Science Department University of Hawaii at Manoa 1 Logical DB Design: ER to Relational Entity sets to

More information

Relational Model. Topics. Relational Model. Why Study the Relational Model? Linda Wu (CMPT )

Relational Model. Topics. Relational Model. Why Study the Relational Model? Linda Wu (CMPT ) Topics Relational Model Linda Wu Relational model SQL language Integrity constraints ER to relational Views (CMPT 354 2004-2) Chapter 3 CMPT 354 2004-2 2 Why Study the Relational Model? Most widely used

More information

High Level Database Models

High Level Database Models ICS 321 Fall 2011 High Level Database Models Asst. Prof. Lipyeow Lim Information & Computer Science Department University of Hawaii at Manoa 9/21/2011 Lipyeow Lim -- University of Hawaii at Manoa 1 Database

More information

Rails: Associations and Validation

Rails: Associations and Validation Rails: Associations and Validation Computer Science and Engineering College of Engineering The Ohio State University Lecture 28 Schemas, Migrations, Models migrations models database.yml db:migrate db:create

More information

Model-View-Controller (MVC)

Model-View-Controller (MVC) Model-View-Controller (MVC) with Ruby on Rails Software Languages Team University of Koblenz-Landau Ralf Lämmel and Andrei Varanovich MVC - a classic definition The Model is the application object The

More information

Microsoft SharePoint Server 2016 for the Site Owner/Power User

Microsoft SharePoint Server 2016 for the Site Owner/Power User Course 55197: Microsoft SharePoint Server 2016 for the Site Owner/Power User Page 1 of 5 Microsoft SharePoint Server 2016 for the Site Owner/Power User Course 55197: 2 days; Instructor-Led Introduction

More information

Week. Lecture Topic day (including assignment/test) 1 st 1 st Introduction to Module 1 st. Practical

Week. Lecture Topic day (including assignment/test) 1 st 1 st Introduction to Module 1 st. Practical Name of faculty: Gaurav Gambhir Discipline: Computer Science Semester: 6 th Subject: CSE 304 N - Essentials of Information Technology Lesson Plan Duration: 15 Weeks (from January, 2018 to April, 2018)

More information

object/relational persistence What is persistence? 5

object/relational persistence What is persistence? 5 contents foreword to the revised edition xix foreword to the first edition xxi preface to the revised edition xxiii preface to the first edition xxv acknowledgments xxviii about this book xxix about the

More information

Standard. Number of Correlations

Standard. Number of Correlations Computer Science 2016 This assessment contains 80 items, but only 80 are used at one time. Programming and Software Development Number of Correlations Standard Type Standard 2 Duty 1) CONTENT STANDARD

More information

Moodle 3.1 Backup and Restore

Moodle 3.1 Backup and Restore Moodle 3.1 Backup and Restore You can only restore a backup into courses that you are enrolled in as a teacher. Be careful when restoring a course don t select Delete the contents of this course and then

More information

Repetition Algorithms

Repetition Algorithms Repetition Algorithms Repetition Allows a program to execute a set of instructions over and over. The term loop is a synonym for a repetition statement. A Repetition Example Suppose that you have been

More information

Django REST Framework JSON API Documentation

Django REST Framework JSON API Documentation Django REST Framework JSON API Documentation Release 2.0.0-alpha.1 Jerel Unruh Jan 25, 2018 Contents 1 Getting Started 3 1.1 Requirements............................................... 4 1.2 Installation................................................

More information

1. Write two major differences between Object-oriented programming and procedural programming?

1. Write two major differences between Object-oriented programming and procedural programming? 1. Write two major differences between Object-oriented programming and procedural programming? A procedural program is written as a list of instructions, telling the computer, step-by-step, what to do:

More information

6.170 Tutorial 7 - Rails Security. Prerequisites. Goals of this tutorial. Resources

6.170 Tutorial 7 - Rails Security. Prerequisites. Goals of this tutorial. Resources 6.170 Tutorial 7 - Rails Security Introduction Sessions Session Hijacking Replay Attacks Session Fixation CSRF Hackers Love Mass Assignment Injection SQL Injection Cross Site Scripting (XSS) Logging Authorizing

More information