Class: WeixinPam::UserAccountsController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- WeixinPam::UserAccountsController
- Defined in:
- app/controllers/weixin_pam/user_accounts_controller.rb
Instance Method Summary collapse
-
#create ⇒ Object
POST /user_accounts.
-
#destroy ⇒ Object
DELETE /user_accounts/1.
-
#edit ⇒ Object
GET /user_accounts/1/edit.
-
#index ⇒ Object
GET /user_accounts.
-
#new ⇒ Object
GET /user_accounts/new.
-
#show ⇒ Object
GET /user_accounts/1.
- #sync ⇒ Object
-
#update ⇒ Object
PATCH/PUT /user_accounts/1.
Instance Method Details
#create ⇒ Object
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(user_account_params) if @user_account.save redirect_to @user_account, notice: 'User account was successfully created.' else render :new end end |
#destroy ⇒ Object
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 |
#edit ⇒ Object
GET /user_accounts/1/edit
24 25 |
# File 'app/controllers/weixin_pam/user_accounts_controller.rb', line 24 def edit end |
#index ⇒ Object
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 |
#new ⇒ Object
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 |
#show ⇒ Object
GET /user_accounts/1
15 16 |
# File 'app/controllers/weixin_pam/user_accounts_controller.rb', line 15 def show end |
#sync ⇒ Object
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: $!. } end |
#update ⇒ Object
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(user_account_params) redirect_to @user_account, notice: 'User account was successfully updated.' else render :edit end end |