Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8769531
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T17:22:04+00:00 2026-06-13T17:22:04+00:00

I am using ActiveAdmin to render an index table for a model. The config

  • 0

I am using ActiveAdmin to render an index table for a model.

The config looks like this:

ActiveAdmin.register User do
  index do
    selectable_column
    column :username
    column "Email" do |u|
      raw "<span title='#{u.email}'>#{truncate(u.email, length: 14)}</span>"
    end
  end
end

The rendered HTML for the “email” TD looks like this:

  <td class=""><span title="useremail@example.com">useremail...</span></td>

I have tried passing class: ‘foo’ before the block and a few things like that but none have worked.

All of the columns that are not being created with the block syntax are getting a class attribute equal to the field name.

How do I set the class for the TD when using a block to render the column?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T17:22:05+00:00Added an answer on June 13, 2026 at 5:22 pm

    you have to override build_table_cell method,
    you can take needed code here https://gist.github.com/3995962

    put it to initializers folder.

    now you can use it like

    column(:status, :sortable => 'enabled', :class=>'status') do |row|
            #some logic 
         end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this: ActiveAdmin.register User do controller do def show @user = User.find(params[:id]) show!
I'm using activeadmin and for whatever reason it's not like my Tag model. I
Question: How can I achieve the model design below using ActiveAdmin and Devise 2?
I have a rails app that is using Devise, with a User model, no
I've got a User resource that I'm using ActiveAdmin to display. Is it possible
I'm using Rails 3, ActiveAdmin and Kaminari. I have this on the documents.rb file
I have 2 activeadmin resources, both are subclasses of a model, using STI. For
Using this question and answer ( Use both Account and User tables with Devise
How do you get ActiveAdmin index page to sort a certain column on default
I'm using rails-settings by Squeegy from https://github.com/Squeegy/rails-settings as well as Activeadmin . What I'm

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.