Truncate data in ActiveAdmin index page -
is possible truncate data displayed attribute in activeadmin index page? 1 of attributes contains lot of text makes layout of table on index page hard at.
i'm trying this...
activeadmin.register post index column :id column :title column :body |body| truncate(body, omision: "...", length: 100) end column :author end end
but error method 'truncate' doesn't exist.
there no need hide column, can use helpers in activeadmin, here case user comments in ../admin/user/:id:
activeadmin.register user panel "coments" table_for user.comments column :id column "comment" |comment| truncate(comment.content, omision: "...", length: 100) end column "created at" |comment| l comment.created_at, format: :long end end end end
will result in:
"lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt..."
activeadmin.register post index column :id column :title column :body |post| truncate(post.body, omision: "...", length: 100) end column :author end end
Comments
Post a Comment