Minitopics

http://bit.ly/1F6nm8L

PC
M

oncatenation

inification

re-compiliation

Today's stuff

  • AJAX!!
  • Deploying your app on Heroku
  • Rails associations
  • Project time

Update parts of a web page, without reloading the whole page.

Minitopic 1

User Experience :)

Cool huh!?

Ajax

everything!!

Ajax-ified?? (Yes, No, Maybe)

No

User Login

Comments on a Blog

Messaging System

Contact Us From

Yes

Yes

Maybe

Make your app available to the world! :)

Minitopic 2

We stand on the shoulders of giants

But wait!!!

To the rescue!!!

  • Make sure your rails server is running
  • ./ngrok <port-number>
  • Go to url
  • Your app live!!

ngrok

A little break

Rails associations

Minitopic 3

- An employee has many tasks

- A task belongs to one employee

Scenario: Employees can create tasks for themselves

Has Many, Belong To

Has Many, Belong To

Task.first.employee
Employee.first.tasks

- An employee has many tasks

- A task has many employees

Scenario: Tasks are assigned to a group of employees

has_and_belongs_to_many

Task.first.employees
Employee.first.tasks

has_and_belongs_to_many

Other examples

  • A task has many tags. A tag has many tasks.
  • An event has many attendees. Attendee has many events

has_and_belongs_to_many

- An employee has many tasks

- A task has many employees

Scenario: Tasks are assigned to a employees. But they are assigned at different times.

has_many :through

Task.first.employees
Employee.first.tasks

has_many :through

Other examples

  • Patients make appointments to see physicians
  • Students have classes with many teachers

has_many :through

Three associations today

  • has_many, belongs_to
  • has_and_belongs_to_many
  • has_many :through

There's lots more!!

What did we just learn?

  • AJAX!!
  • Deploying your app on Heroku
  • Rails associations

Have a wonderful Thanksgiving break!

Minitopics

By Rails Decal

Minitopics

  • 1,447