aboutsummaryrefslogtreecommitdiffstats
path: root/app/controllers/users_controller.rb
blob: 2b1c2bd142080f5e362dc06c7b00ebe7766d001b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
class UsersController < BreadcrumbController

  defaults :resource_class => User

  def create
    @user = current_organisation.users.build(params[:user])

    if @user.valid?
      @user.invite!
      respond_with @user, :location => organisation_user_path(@user)
    else
      render :action => 'new'
    end
  end

  def update
    update! do |success, failure|
      success.html { redirect_to organisation_user_path(@user) }
    end
  end

  def destroy
    destroy! do |success, failure|
      success.html { redirect_to organisation_path }
    end
  end

  protected

  def begin_of_association_chain
    current_organisation
  end

end