diff options
| author | Marc Florisson | 2014-06-23 16:06:27 +0200 | 
|---|---|---|
| committer | Marc Florisson | 2014-06-23 16:06:27 +0200 | 
| commit | af8b99cd3892091328fba17ee1a958ca1cea5eaf (patch) | |
| tree | 00543c7d18c44affd919ea7c73b0f07fae255d60 | |
| parent | 663b01cd8d6f8cf0a8a2dec00878c39fa041fb82 (diff) | |
| download | chouette-core-af8b99cd3892091328fba17ee1a958ca1cea5eaf.tar.bz2 | |
users_controller, test if user is valid, Mantis 26693
| -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 | 
