Class: WeixinPam::UserAccountsController

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

Instance Method Summary collapse

Instance Method Details

#createObject

POST /user_accounts



28
29
30
31
32
33
34
35
36
# File 'app/controllers/weixin_pam/user_accounts_controller.rb', line 28

def create
  @user_account = @public_account.user_accounts.new()

  if @user_account.save
    redirect_to @user_account, notice: 'User account was successfully created.'
  else
    render :new
  end
end

#destroyObject

DELETE /user_accounts/1



48
49
50
51
# File 'app/controllers/weixin_pam/user_accounts_controller.rb', line 48

def destroy
  @user_account.destroy
  redirect_to user_accounts_url, notice: 'User account was successfully destroyed.'
end

#editObject

GET /user_accounts/1/edit



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

def edit
end

#indexObject

GET /user_accounts



9
10
11
12
# File 'app/controllers/weixin_pam/user_accounts_controller.rb', line 9

def index
  @page_name = 'user_accounts_index'
  @user_accounts = @public_account.user_accounts
end

#newObject

GET /user_accounts/new



19
20
21
# File 'app/controllers/weixin_pam/user_accounts_controller.rb', line 19

def new
  @user_account = @public_account.user_accounts.new
end

#showObject

GET /user_accounts/1



15
16
# File 'app/controllers/weixin_pam/user_accounts_controller.rb', line 15

def show
end

#syncObject



53
54
55
56
57
58
# File 'app/controllers/weixin_pam/user_accounts_controller.rb', line 53

def sync
  UserAccount.sync_from_server(@public_account)
  render json: { action: 'sync_users', success: true }
rescue
  render json: { action: 'sync_users', success: false, error: $!.message }
end

#updateObject

PATCH/PUT /user_accounts/1



39
40
41
42
43
44
45
# File 'app/controllers/weixin_pam/user_accounts_controller.rb', line 39

def update
  if @user_account.update()
    redirect_to @user_account, notice: 'User account was successfully updated.'
  else
    render :edit
  end
end