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

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -