Ruby/Rails - Parsing and Displaying HTML from a Models Attribute -
i have rails model called events has field/attribute called :description.
i migrated under type t.text rather t.string since going displaying large amount of data.
so.... i'm @ point display <%= @event.description %> in neat way , break of sentences rather 1 large block of information.
i hoping insert <p> or other html codes how text displayed.
the problem inserting <p> field prints <p> , not desired action of html command.
how can add html styling text attribute?
you can use <%=raw @event.description %> echo unescaped content. aware potential xss security hole, if users can ever affect content. highly recommend using sanitize helper strip out unwelcome markup before write out.
Comments
Post a Comment