Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Final wave (4) #106

Open
wants to merge 4 commits into
base: rmt/master
Choose a base branch
from
Open

Final wave (4) #106

wants to merge 4 commits into from

Conversation

rmtolmach
Copy link

This wave was more manageable for me to wrap my head around than the others. I think drawing out the relationships helped. I feel slow - I finish HOURS after everyone else.

class Person < ActiveRecord::Base
has_many :tasks

def self.incomplete(pers_id)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the idea to use a class method here to extend the vocabulary associated with the Person model!

As we'll seen soon enough, you can actually move this method into the Task class and set tasks = Task.all instead of person.tasks (no longer any need for a pers_id parameter).

This will allow you to view all incomplete tasks with Task.incomplete -- however, it will also allow you to view the incomplete tasks for a single person with person.tasks.incomplete.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants