1
5 Comments

How to add rich text to your Rails app using Action Text and Trix

Hey IH Rails-ers!

I'm currently working on DinoSaaS - I'm building open-source MVP's in Rails along with step-by-step tutorials.

I wrote this 6-step tutorial on how to add rich text to your Rails app.

I'd looked into open-source rich text editors in the past, and this was far easier than I expected it to be:

  1. Step 1 - Install Active Storage and Action Text
  2. Step 2 - Add rich text field to model
  3. Step 3 - permit rich text field as a param in controller
  4. Step 4 - Add rich_text_area to model form
  5. Step 5 - Render rich text in show view
  6. Step 6 - Install image_processing gem to be able to process images.

Should take <10 minutes from start to finish.

Let me know what you think of the linked tutorial and if you have any ideas for what you'd like to see next!

  1. 1

    The tricky part starts when you want to use ActiveStorage in production - gotta connect AWS S3 ;)

  2. 1

    I will not recommend Trix if you care about SEO.

    1. 1

      That's interesting; why do you say that? Is it Trix in general or all Rich Text?

      For my use case, I was only using it for an internal bug tracking app where SEO would not be a concern.

      1. 3

        No p tag. Trix uses div for paragraph
        Images are inside figure instead of img tag
        No support for tables.
        H2 and below not supported out of the box?

        1. 1

          Very good point about actually...
          Let's say: for all non-SEO-sensitive cases, Trix is the go-to Rails approach :)

  3. 1

    This comment was deleted 4 years ago.

Trending on Indie Hackers
After 10M+ Views, 13k+ Upvotes: The Reddit Strategy That Worked for Me! 42 comments Getting first 908 Paid Signups by Spending $353 ONLY. 24 comments 🔥Roast my one-man design agency website 21 comments I talked to 8 SaaS founders, these are the most common SaaS tools they use 20 comments What are your cold outreach conversion rates? Top 3 Metrics And Benchmarks To Track 19 comments Hero Section Copywriting Framework that Converts 3x 12 comments