Skip to content

Instantly share code, notes, and snippets.

@marcosinger
Created January 17, 2012 11:42
Show Gist options
  • Save marcosinger/1626370 to your computer and use it in GitHub Desktop.
Save marcosinger/1626370 to your computer and use it in GitHub Desktop.
def give_specific_permissions_to_user(user, permission)
profile = if user.profiles.empty?
user_profile = Iceleres::UserProfile.create :user_id => user.id, :profile => Factory(:profile)
user_profile.profile
else
user.profiles.first
end
profile.permissions << Factory(permission)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment