Skip to content

Instantly share code, notes, and snippets.

@kivanio
Forked from shivanibhanwal/gist:4bbf63b32cbea81d359e
Last active August 29, 2015 14:16
Show Gist options
  • Select an option

  • Save kivanio/d54740b922ddeb2f08d2 to your computer and use it in GitHub Desktop.

Select an option

Save kivanio/d54740b922ddeb2f08d2 to your computer and use it in GitHub Desktop.
# 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