Skip to content

2 15 2012 (Wed) at Kabam minutes

judytuna edited this page Feb 16, 2012 · 7 revisions

2/15/12 (Wed) at Kabam minutes

We met on Wednesday because Tuesday was Women2.0 PITCH and Valentine's Day. Our feature for the week was #5, "Volunteer can sign up for an event. Volunteer can RSVP no for an event." But first, we had a presentation from our hosting company.

TDD

TDD Presentation Notes

Building our feature (we're in week 5)

Then, we walked through how to implement our feature. We talked about how to create a join table, and has many through. Notes for that coming soon.

Implementing "Volunteer can RSVP yes or no to an event" is homework this week!

The relevant chapter in the Hartl tutorial is: Chapter 11: Following Users.

  • Hartl's "followed" is our "user"
  • Hartl's "following" is our "event"
  • Hartl's "relationships" is our "volunteer_rsvps"

So instead of picture 3.2 of Hartl which says:

$ rails generate model Relationship follower_id:integer followed_id:integer

we will write this:

$ rails generate model Volunteer_Rsvp user_id:integer event_id:integer attending:boolean

And instead of listing 11.7, which says (in app/models/relationship.rb):

class Relationship < ActiveRecord::Base
  attr_accessible :followed_id

  belongs_to :follower, class_name: "User"
  belongs_to :followed, class_name: "User"
end

ours will have the filename app/models/volunteer_rsvp.rb and say:

class Volunteer_Rsvp < ActiveRecord::Base
  belongs_to :user
  belongs_to :event
end

Instead of listing 3.2 which says in app/models/user.rb:

has_many :followed_users, through: :relationships, source: :followed

ours will say in app/models/user.rb:

has_many :events, through: :volunteer_rsvps

And instead of reverse relationships, we're going to say in app/models/events.rb:

has_many :users, through: :volunteer_rsvps