diff options
| -rw-r--r-- | app/controllers/users_controller.rb | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 3b4775fc7..b57b9d54a 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -2,8 +2,13 @@ class UsersController < InheritedResources::Base def create @user = current_organisation.users.build(params[:user]) - @user.invite! - respond_with @user, :location => organisation_user_path(@user) + + if @user.valid? + @user.invite! + respond_with @user, :location => organisation_user_path(@user) + else + render :action => 'new' + end end def update @@ -19,7 +24,7 @@ class UsersController < InheritedResources::Base end protected - + def begin_of_association_chain current_organisation end |
