Database and Active Record

6th lecture, May 20, 2019

Projects in Information Technology II

http://www.sw.it.aoyama.ac.jp/2019/Projects2/lecture6.html

Martin J. Dürst

AGU

© 2019 Martin J. Dürst 青山学院大学

ミニテスト

 

Today's Schedule

 

Last Lecture's Exercises

Important:
Always start ERB templates with <!DOCTYPE,
not with <%... Ruby code

  

Course Overview

 

Database

books
title authors isbn price ...
Agile Web Development Sam, Dave, David 978-1-68050-171-1 $46.00 ...
Programming Ruby Dave with Chad and Andy 978-1-93778-549-9 $50.00 ...
Learning Rails 5 Mark, Barnabas, Eric 978-1-491-92619-2 $44.00 ...
... ... ... ... ...

 

Database Engines

 

Object-Relational Mapper/Mapping (ORM)

 

How to Use Active Record (Indepedently)

(this week, we are using Active Record independently of Rails)

 

What Active Record Does

Active Record does the following automatically:

 

Configuration or Convention

 

Convention over Configuration

 

How to Create a New Database Entry

(examples for table books)

 

How to Retrieve Entries from the Database

 

Access to Objects

 

Column Statistics

 

Database used for Exercises

 

Exercise 6a: Calculate Wrestler Statistics

 

Exercise 6b: Web Page with Wrestler Table

 

Exercise 6c: Advanced Exercise (発展問題):

 

Homework