Truncate HTML output on Ruby (and Rails)

For this little blog app, I needed to truncate the post length on the home. Of course it can’t be done by a simple truncate since it can break HTML tags. I found this awesome hack by Mike Burns.

One thought to “Truncate HTML output on Ruby (and Rails)”

  1. well seeing as i was rseiad by two mexican parents i grew up eating mexican food lol so there is many things u can make from enchiladas,barbacoa,menudo,tacos,tamales etc one easy recepie u can do is enchiladas rojas ( red enchiladas) your gonna need around 10 chiles cascabeltortillasqueso panelagoya yellow riceokay ur gonna want to boil the chiles for a while until they are tender and then u are going to put them in a blender and after u have liquified them u can strain them until ur salsa is nice and smooth then u are gonna want to heat up your corn tortillas until they are soft enough to roll, u are gonna want to break up ur queso panella and then place the cheese on the tortilla and roll it up do as many as u can, then heat up a pan on med heat and put oil on it place the rolled up totrtillas on it and then put sauce on top of them, flip them and repeat, and just serve them with the yellow rice, if u have n e questions feel free to email me

Comments are closed.