Changed behavior to return the User instead of just only its id.

This commit is contained in:
Thorsten Eckel 2015-04-08 15:32:20 +02:00
parent afdee69e39
commit 9fc50fa4b9

View file

@ -10,9 +10,9 @@ there is an example file 'contrib/auto_wizzard_example.json'
returns returns
the id of the first created User if a 'auto_wizzard.json' file was found and processed, containing at least one entry in Users the first created User if a 'auto_wizzard.json' file was found and processed, containing at least one entry in Users
1 if a 'auto_wizzard.json' file was found and processed, containing no Users the User with id 1 (NULL) if a 'auto_wizzard.json' file was found and processed, containing no Users
nil if no 'auto_wizzard.json' file was found nil if no 'auto_wizzard.json' file was found
@ -28,7 +28,7 @@ returns
auto_wizzard_hash = JSON.parse(auto_wizzard_file) auto_wizzard_hash = JSON.parse(auto_wizzard_file)
admin_user_id = 1 admin_user = User.find( 1 )
# create Users # create Users
if auto_wizzard_hash['Users'] if auto_wizzard_hash['Users']
@ -45,8 +45,8 @@ returns
:active => true, :active => true,
:roles => roles, :roles => roles,
:groups => groups, :groups => groups,
:updated_by_id => admin_user_id, :updated_by_id => admin_user.id,
:created_by_id => admin_user_id :created_by_id => admin_user.id
} }
) )
@ -55,10 +55,9 @@ returns
) )
# use first created user as admin # use first created user as admin
next if admin_user_id != 1 next if admin_user.id != 1
admin_user_id = created_user.id
admin_user = created_user
} }
end end
@ -79,8 +78,8 @@ returns
email_address_data_symbolized = email_address_data_symbolized.merge( email_address_data_symbolized = email_address_data_symbolized.merge(
{ {
:updated_by_id => admin_user_id, :updated_by_id => admin_user.id,
:created_by_id => admin_user_id :created_by_id => admin_user.id
} }
) )
@ -90,6 +89,6 @@ returns
} }
end end
admin_user_id admin_user
end end
end end