Dumb newbie question - text formatting?

I have a MySQL “text” element that I’m trying to display, but it’s not
formatting (i.e. it’s all one big paragraph). In the AWD depot example
it doesn’t look like they do anything special, but they get formatted
text. I’ve tried it with both:

<%= show.description %> - puts text, and formats according to any HTML
tags I typed in.

and

<%= h(show.description) %> - puts text and HTML tags, no formatting.

What am I missing?

Thanks,

Adam

Hi Adam,

Try simple_format, shown here:
http://api.rubyonrails.org/classes/ActionView/Helpers/TextHelper.html#M00051
3

This page also has other helpful text helpers

Daniel

Daniel H. wrote:

Hi Adam,

Try simple_format, shown here:
http://api.rubyonrails.org/classes/ActionView/Helpers/TextHelper.html#M00051
3

This page also has other helpful text helpers

Daniel

That’s awesome. Thanks.

-Adam

Adam B. wrote:

<%= h(show.description) %> - puts text and HTML tags, no formatting.

What am I missing?

In the depot example Dave T. was using HTML tags to format his
descriptions (and that’s why he didn’t use h() to escape them).

regards

Justin

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs