active admin capitalize the first letter

Viewed 219

My question is simple but I didn't find the answer for it! How to capitalize the first letter in active admin

For example I tried these two but none of them are working

index do
    column :first_name.upcase
    column :last_name.capitalize

I dont have error but they give me blank input

2 Answers

column accepts block, so you can do it like:

  column "First name" do |user|
    link_to user.first_name.capitalize, admin_user_path(user)
  end

Column accepts block and you can customise the column label by sending the string within quotes. Try the below code if you want the label to be "First Name".

index do
  column "First Name" do |user|
    user.first_name
  end
  #other columns
end
Related