Commit dbc3b3180ca1b73f655b4e8480405065264fb4d1
1 parent
8395567c
Exists in
master
and in
28 other branches
ActionItem1165: testing for a resource before
Showing
1 changed file
with
1 additions
and
1 deletions
Show diff stats
db/migrate/069_add_enviroment_id_to_role.rb
... | ... | @@ -19,7 +19,7 @@ class AddEnviromentIdToRole < ActiveRecord::Migration |
19 | 19 | re = RoleWithEnvironment.new(role.attributes) |
20 | 20 | re.environment = env |
21 | 21 | re.save |
22 | - RoleAssignment.find_all_by_role_id(role.id).select{|ra| (ra.resource.kind_of?(Profile) ? ra.resource.environment_id : ra.resource.id) == env.id }.each do |ra| | |
22 | + RoleAssignment.find_all_by_role_id(role.id).select{|ra| ra.resource && (ra.resource.kind_of?(Profile) ? ra.resource.environment_id : ra.resource.id) == env.id }.each do |ra| | |
23 | 23 | ra.role_id = re.id |
24 | 24 | ra.save |
25 | 25 | end | ... | ... |