Skip to content

Instantly share code, notes, and snippets.

@marr
Last active September 30, 2016 17:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save marr/a5c93299ec1b7939ed1ca93587f03d7c to your computer and use it in GitHub Desktop.
Save marr/a5c93299ec1b7939ed1ca93587f03d7c to your computer and use it in GitHub Desktop.
def roles_update_permitted?(user)
new_roles = params.fetch(:staff, {}).fetch(:roles, []).map do |role|
role['type']
end
(new_roles - accessible_roles).empty?
end
{
"staff" : {
"firstName" : "Hip",
"id" : 12,
"lastName" : "Hop",
"roles" : [],
"email" : "hiphop@gmail.com",
"country" : "UK"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment