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

updated role creation #176

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open

updated role creation #176

wants to merge 2 commits into from

Conversation

AndySok
Copy link
Contributor

@AndySok AndySok commented Jun 29, 2020

Addresses #158. Edits the user mutation so that it can accept arrays of roles instead of singular roles. Links to stuyspec/cms#45, so both pull requests must be approved for the change to be properly implemented.

if args["role"] and role != nil and !@new_user.roles.include?(role)
@new_user.roles << role
args["role"].each do |role|
roley = Role.find_by(title: role)
Copy link
Member

Choose a reason for hiding this comment

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

There's a naming convention for variables in this case, and they're usually named with an @ before the name. In this instance, the name would be @role

@user.roles << role
@user.roles.clear
args["role"].each do |role|
roley = Role.find_by(title: role)
Copy link
Member

Choose a reason for hiding this comment

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

Same comment as above.

@AndySok
Copy link
Contributor Author

AndySok commented Jul 3, 2020

Yeah, renamed the variable so now it follows the norms

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