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

Refactor subject model #2070

Merged
merged 3 commits into from Oct 25, 2019
Merged

Conversation

AndyStabler
Copy link
Contributor

@AndyStabler AndyStabler commented Oct 14, 2019

I started a refactor of the subject class aages ago and I'm finally getting round to looking at it again.

I'd like to poke the sync method to see what it looks like when it's working on an instance of subject instead of operating at a class level.

@AndyStabler AndyStabler force-pushed the refactor-subject-model branch 3 times, most recently from 14327c4 to 655566f Compare October 17, 2019 21:02
@andrew
Copy link
Member

andrew commented Oct 21, 2019

Looking good @AndyStabler 👍

@AndyStabler AndyStabler force-pushed the refactor-subject-model branch 3 times, most recently from ebc7cce to a27ff97 Compare October 22, 2019 20:59
sync_involved_users if (saved_changes.keys & notifiable_fields).any?
end

def self.sync(remote_subject)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

How do you feel about having an instance and a class method with the same name? We can change this to something else if we like I'm just wary of changing too much in one PR.

Copy link
Member

Choose a reason for hiding this comment

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

I don't mind that, I've done it a lot in the past

@AndyStabler AndyStabler changed the title [WIP] Refactor subject model Refactor subject model Oct 22, 2019
Lots of the stuff going on inside the Subject.sync method is acting on
an instance and not doing things at the class level. This commit extracts
a Subject#sync instance method to make things more object oriented and
to allow us to start extracting the logic out of this method. This
should hopefully make things easier to understand what's going on.
@AndyStabler
Copy link
Contributor Author

Thanks for taking a look @andrew 🙇 I've cleaned things up and it's ready for review!

@andrew andrew merged commit 8ef8d9b into octobox:master Oct 25, 2019
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.

None yet

2 participants