-
Notifications
You must be signed in to change notification settings - Fork 32
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
Manage and display members (#8) #74
Conversation
biography "MyText" | ||
end | ||
|
||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ca we correct indentation here please?
cc @GalkaS |
@coaxial Would love to merge. Are you up for rebasing with master? |
I'm getting weird conflicts, it looks like unresolved things were committed?
|
@coaxial I was able to rebase this on my machine. Let's me know if you need a hand, happy to help. I didn't see any unresolved commits. Please let me know if you see any. |
@coaxial Would you like us to rebase that branch before merging? |
This is ready for review if anybody is up for it. |
Here are a few comments in disguise of a code review: More important:
Less important:
expect(member).to_not be_valid instead of: expect(member.valid?).to be false
member = Member.new(email: nil)
expect(member).to_not be_valid Terser, and also tests will run faster 🚀 |
To expand on @cawel idiomatic comments:
can also be written as
Positive expectations/assertions are often a little easier to read. |
Better indeed. |
Thank you for the feedback, much appreciated. We'll work on it tonight with @GalkaS |
@nicholasjhenry should probably jump in before you refactor tonight, as he seemed to have (during the workshop) a clear idea in which db table to put that foreign key (either in 'users' table or 'members' table). |
class Member < ActiveRecord::Base | ||
has_many :events | ||
has_many :organizations | ||
has_one :user |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we write a test for this association?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@GalkaS I don't test the presence of associations specifically -- higher level tests will verify if this association exists -- i.e the app will blow up pretty quickly when doing a request spec for example.
Sorry I couldn't address this earlier. The foreign key should really be placed on the member. i.e. a I understand that you placed it on the user as the foreign key in Administrate doesn't support Thank you for taking the time to make this amendment, and again sorry I didn't respond earlier. |
Note that based on his explanation, @nicholasjhenry probably meant to write: a |
@cawel 👍 |
OK, just shows how confused I was 🙀 The current version of Administrate we have does not support Thanks to @cawel for keeping my associations speak honest. |
# Each different type represents an Administrate::Field object, | ||
# which determines how the attribute is displayed | ||
# on pages throughout the dashboard. | ||
ATTRIBUTE_TYPES = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Freeze mutable objects assigned to constants.
I fully tested the feature on my machine and I fixed stuff in a way that doesn't break anything if deployed. However, you will notice in @coaxial, can you create that part so members can be fully managed and associated to users and to manage the user record too? |
ATTRIBUTE_TYPES = { | ||
events: Field::HasMany, | ||
organizations: Field::HasMany, | ||
#user: Field::BelongsTo, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing space after #.
@@ -53,4 +55,5 @@ def self.default_user | |||
def active_for_authentication? | |||
super && email != DEFAULT_USER_EMAIL | |||
end | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Extra empty line detected at class body end.
Manage and display members (#8)
Add a Member model + tests and add it to the admin panel