Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6862615
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T02:40:58+00:00 2026-05-27T02:40:58+00:00

Users at my website are able to write comments through special form. Field for

  • 0

Users at my website are able to write comments through special form. Field for value is a normal textarea. Now every comment is displayed without any html tags. It looks kinda weird when someone for instance post long comment. I would like to filter out value from all tags except new line chars (\n or \r\n).

I display that comments like that: <%=h @comment.value %>

What should I change? I was thinking about writing whole new method to filter all tags expect new line chars but I am sure that Ruby on Rails offers easier solution here.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T02:40:58+00:00Added an answer on May 27, 2026 at 2:40 am

    use simple_format and h together

    <%= simple_format(h(@comment.value)) %>
    

    simple_format essentially use gsub to convert line break into <br> and <p> tags.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Users of the website need to able to store images in their area ,
We have a simple registration form for our website users where we only require
I want users on my website to be able to pick a hex colour,
on my project website users are able to login and move from page to
We have developed our website(Business users website) in .net Framework 2.0 Our client us
On my website users can keyword search and find desired results. (Just a simple
I want to set an alert service for my website users for there tasks.
Users of our website often type in a lot of garbage for the name
I have a internal website that users log into. This data is saved as
I run a website where users can post items (e.g. pictures). The items are

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.