Skip to content

Instantly share code, notes, and snippets.

@shivanibhanwal
Last active August 29, 2015 14:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save shivanibhanwal/4bbf63b32cbea81d359e to your computer and use it in GitHub Desktop.
Save shivanibhanwal/4bbf63b32cbea81d359e to your computer and use it in GitHub Desktop.
ActiveAdmin View TableFor and AttributesTable class customization
# Add this code to a new file and you can put it under app/admin/lib folder or else config/initializer/actice_admin.rb
module ActiveAdmin
module Views
class TableFor
def html_column(attribute)
column(attribute){ |model| model[attribute].html_safe }
end
def bool_column(attribute)
column(attribute){ |model| model[attribute] ? '✔'.html_safe : '✗'.html_safe }
end
end
class AttributesTable
def html_row(attribute)
row(attribute){ |model| model[attribute].html_safe }
end
def bool_row(attribute)
row(attribute){ |model| model[attribute] ? '✔'.html_safe : '✗'.html_safe }
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment