Skip to content

Commit

Permalink
make sure UsersController#create creates account assocations
Browse files Browse the repository at this point in the history
refs #5833

Change-Id: I76e2e6879e33cc61752e084ec5d94ca9069fc0f6
Reviewed-on: https://gerrit.instructure.com/6586
Tested-by: Hudson <[email protected]>
Reviewed-by: Bryan Madsen <[email protected]>
  • Loading branch information
ccutrer committed Oct 31, 2011
1 parent 7be2641 commit b6fca29
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
2 changes: 2 additions & 0 deletions app/controllers/users_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -499,6 +499,8 @@ def create
@user.name ||= params[:pseudonym][:unique_id]

@pseudonym ||= @user.pseudonyms.build(:account => @context)
# pre-populate the reverse association
@pseudonym.user = @user
@pseudonym.attributes = params[:pseudonym]
@pseudonym.account = @context
@pseudonym.workflow_state = 'active'
Expand Down
1 change: 1 addition & 0 deletions spec/controllers/users_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@
p.user.communication_channels.length.should == 1
p.user.communication_channels.first.should be_unconfirmed
p.user.communication_channels.first.path.should == '[email protected]'
p.user.associated_accounts.should == [Account.default]
end

it "should complain about conflicting unique_ids" do
Expand Down

0 comments on commit b6fca29

Please sign in to comment.