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 -- Posted via http://www.ruby-forum.com/.
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 -----Original Message----- From: rails-bounces@lists.rubyonrails.org [mailto:rails-bounces@lists.rubyonrails.org] On Behalf Of Adam Bloom Sent: Friday, April 14, 2006 2:15 PM To: rails@lists.rubyonrails.org Subject: [Rails] 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 -- Posted via http://www.ruby-forum.com/. _______________________________________________ Rails mailing list Rails@lists.rubyonrails.org http://lists.rubyonrails.org/mailman/listinfo/rails
Daniel Higginbotham 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 > > DanielThat''s awesome. Thanks. -Adam -- Posted via http://www.ruby-forum.com/.
Adam Bloom wrote:> 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?In the depot example Dave Thomas was using HTML tags to format his descriptions (and that''s why he didn''t use h() to escape them). regards Justin