Class: UserAccountsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/user_accounts_controller.rb

Instance Method Summary collapse

Methods inherited from ApplicationController

#current_navable, #current_navable=, #current_user, #point_navigation_to, #redirect_www_subdomain, #set_locale

Instance Method Details

#createObject



28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'app/controllers/user_accounts_controller.rb', line 28

def create
  @user = User.find_by_id(params[:user_id])
  @user_account = @user.

  respond_to do |format|
    if @user_account.save

      @user.send_welcome_email
      
      format.html { redirect_to :back, notice: t(:user_account_created) }
      format.json { render json: @user_account, status: :created, location: @user_account }
    else
      format.html { render action: "new" }
      format.json { render json: @user_account.errors, status: :unprocessable_entity }
    end
  end
end

#destroyObject



46
47
48
49
50
51
52
53
54
# File 'app/controllers/user_accounts_controller.rb', line 46

def destroy
  @user_account = UserAccount.find(params[:id])
  @user_account.destroy

  respond_to do |format|
    format.html { redirect_to :back, notice: t(:user_account_deleted)  }
    format.json { head :no_content }
  end
end

#editObject



24
25
26
# File 'app/controllers/user_accounts_controller.rb', line 24

def edit
  @user_account = UserAccount.find(params[:id])
end

#newObject



15
16
17
18
19
20
21
22
# File 'app/controllers/user_accounts_controller.rb', line 15

def new
  @user_account = UserAccount.new

  respond_to do |format|
    format.html # new.html.erb
    format.json { render json: @user_account }
  end
end

#showObject



6
7
8
9
10
11
12
13
# File 'app/controllers/user_accounts_controller.rb', line 6

def show
  @user_account = UserAccount.find(params[:id])

  respond_to do |format|
    format.html # show.html.erb
    format.json { render json: @user_account }
  end
end