Hello, The following is a toggle div, in which I''m trying to add a newline after the word ''notes:'' <%= content_tag(:div, content_tag(:p, "Our programme notes are being prepared.", :class => ''regtextend''), :id => ''notes'') %> And this doesn''t work: <%= content_tag(:div, content_tag(:p, "Our programme notes\nare being prepared.", :class => ''regtextend''), :id => ''notes'') %> When using simple_format, \n breaks the line. I see that it wouldn''t work the same way, but is there a way to escape in the middle of a string in this case? Help would be appreciated! Thanks -- Jon. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Why would it? is html what gets rendered, use <br/> and end the string with html_safe -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Try something like this <%= content_tag(:div, content_tag(:p, "Our programme notes are being prepared.<br />", :class => ''regtextend''), :id => ''notes'').html_safe %> Or <%= raw content_tag(:div, content_tag(:p, "Our programme notes are being prepared.<br />", :class => ''regtextend''), :id => ''notes'').html_safe %> On Fri, Jul 8, 2011 at 5:50 PM, radhames brito <rbritom-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Why would it? is html what gets rendered, use <br/> and end the string with > html_safe > > -- > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. >-- Rajeev Kannav Sharma<http://www.google.com/search?q=Rajeev+Kannav+Sharma&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:en-US:official&client=firefox-a> -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
I couldn''t actually get it to work, but good to learn about html_safe! I ended up with: <%= content_tag(:div, simple_format("Our programme notes\nare being prepared.", :class => ''regtextend''), :id => ''notes'') %> Not sure if that''s the best solution, but it works well. Thanks again for the help -- Jon. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.