2017-11-10 1 views
0

私のレールアプリケーションでは、私はactive adminをインストールしました。 users indexページでは、デフォルトでall columnsが表示されています(ユーザーテーブルの列)。 custom column called "become user" in this users index view(ユーザーの表の列ではありません)を追加します。このcolumnの下にuser namehyperlinkとして表示します。そのリンクをクリックすると、adminは特定のユーザーアカウントにログインします。このスイッチング機能を実装するために、私はswitch user gemを使用しています。 Active Adminでこのビューをカスタマイズする方法は?あなたがアプローチして行く必要があるか、アクティブな管理にすべてのユーザーのためのリンクを生成するアクティブな管理者のテーブルに存在しないカスタム列をレールに追加するにはどうすればよいですか?

ActiveAdmin.register User do 

    permit_params do 
    permitted = [:email, :fname, :lname, :phone] 
    # permitted << :other if resource.something? 
    # permitted 
end 

    # Filterable attributes on the index screen 
    filter :email 
    filter :fname 
    filter :lname 
    filter :phone 
    filter :current_sign_in_at 
    filter :created_at 


    # Customize columns displayed on the index screen in the table 
    index do 
    selectable_column 
    id_column 
    column :email 
    column :fname 
    column :lname 
    column :phone 
    column :current_sign_in_at 
    # column :sign_in_count 
    column :created_at 

    # actions 
    end 

    form do |f| 
    inputs 'Details' do 
     input :email 
     input :password 
     input :fname 
     input :lname 
     input :phone 
    end 
    actions 
    end 

    controller do 
    end 

end 
+0

'User'モデルの' ActiveAdmin'設定を貼り付けることはできますか? – AntonTkachov

+0

こんにちはJohn、コードなしでこのような質問を貼り付けます。このコミュニティのルールを読んでください。https://stackoverflow.com/help/how-to-ask過去に同様の質問を貼り付けました。広範で、コード例は含まれていません。https://stackoverflow.com/questions/46033523/how-to-authenticate-the-user-from-the-emailとこれもまた別のものですhttps://stackoverflow.com/questions/44971139/signin-user-upon-clicking-the-link-in-email-automatically -in-rails-application –

+0

こんにちは、@AntonTkachov。コードで質問を更新しました – John

答えて

関連する問題