aboutsummaryrefslogtreecommitdiffstats
path: root/app/controllers/users_controller.rb
blob: 3b4775fc73d861f12366bc126c888ffe8af32b05 (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
class UsersController < InheritedResources::Base

  def create
    @user = current_organisation.users.build(params[:user])
    @user.invite!
    respond_with @user, :location => organisation_user_path(@user)
  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