blob: b57b9d54ada8fde7f1811b91dd76de7e15dda078 (
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
  | 
class UsersController < InheritedResources::Base
  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
  |