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?
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