0

I need to “embed” a link in an object property, such as deal.description = "Click <a href='www.something.com'>here!</a>".

Doing it that way doesn’t seem to work; my show page just shows all that text (with the html tag and everything).

Trying to use #{link_to 'text', 'url'} gives NoMethodError: undefined method 'link_to' for main:Object.

This is currently in my seeds.rb file but I'll also need to somehow allow my users to enter a link inside the description on the new page.

How do I do this?

5
  • In the rails console, what does puts deal.description display ? Commented Jan 21, 2019 at 15:48
  • 1
    Possible duplicate of Ruby on Rails: how to render a string as HTML? Commented Jan 21, 2019 at 15:50
  • @LolWalid You can check out the calendar <a href='http://mail01.tinyletterapp.com/FaresYouCanUse/today-s-flights-iowa-new-hampshire-south-carolina-nevada/13473421-www.google.com/flights?c=cf040a38-8c96-4f9b-9338-8c223c053a53'>here</a>. Commented Jan 21, 2019 at 15:51
  • 1
    Look at my second comment, it should help you ! Commented Jan 21, 2019 at 15:52
  • The second comment was exactly what I needed, thank you! Commented Jan 21, 2019 at 16:05

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.