Hello Ruby forum, I''ve been looking at the other threads before posting this, but I can''t find a good solution to the problem I''m having. The problem: in one of my views, I have the following code: <% for column in BlogPost.content_columns %> <td><%=h(simple_format(blog_post.send(column.name))) %></td> <% end %> This does exactly what it''s supposed to do - it preserves the line breaks and carriage returns entered into my text fields by adding <p>,<br /> and suchlike. But that''s all it does. If I entered: "Please have a nice day" into the "body" text field of my blog engine, I would get: "Please<p> have<p> a nice day" back (I left some HTML code out, but you get the idea). How do I get back exactly what I entered? If you answer, would you mind posting some code? I still haven''t seen a code example that solves this problem. Thanks in advance! -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
onemind wrote:> How do I get back exactly what I entered? If you answer, would you mind > posting some code? I still haven''t seen a code example that solves thisThis is without code.. Sorry ;) Have a look at the incoming posting. If you enter the message directly into your database, it wont have any line breaks at all. If a message comes from a textfield on your page it will contain line breaks like "\n". bye. andreas -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
> Andreas wrote: > Have a look at the incoming posting. If you enter the message directly > into your database, it wont have any line breaks at all. If a message > comes from a textfield on your page it will contain line breaks like > "\n".Hi andreas, I feed the text into the database from a :text field in my view. I looked at what was stored in my tables, and it looks like it has line breaks. They just don''t show up in my UI. Any insights? Thank you, onemind -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---