Skip to content

Instantly share code, notes, and snippets.

@vijaydev
Created May 20, 2011 10:40
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 vijaydev/982700 to your computer and use it in GitHub Desktop.
Save vijaydev/982700 to your computer and use it in GitHub Desktop.
@user.allotments.map &:destroy # delete old allotments
# format: [ ['role', 'human-role', [1,2,3]], ['role', 'human-role', [1,2,3]] ] defined in user model.
allots = []
params[:roles_divisions].each do |rd|
rd[2].each do |d|
allots << Allotment.create(:user_id => @user.id, :division_id => d.to_i, :role_name => rd[0])
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment