DEV Community

Step by Step guide to test Rails ActiveText

Adrien Poly on October 04, 2018

๐ŸšงโŒ EDITED ActionText is now fully released in Rails 6 don't follow this guide that was written for the preview version You might have se...
Collapse
 
colinrubbert profile image
Colin Rubbert

With regards to adding action_text to an existing app, for instance if you already had:

post.rb
:title,   t.string
:content, t.text

Would you have to run a migration to remove post :content and then implement has_rich_text :content to the model?

If you just add the has_rich_text field does it just update those paths, ignore the previous model schema, or something else?

Collapse
 
adrienpoly profile image
Adrien Poly

has_rich_text adds a polymorphic link to your table. This means that the rich text content is not stored in the posts table but in a dedicated polymorphic table for rich content.

Therefore in your case, you would need to migrate your content to this new table.

Collapse
 
philnash profile image
Phil Nash

This is a great guide, thanks for putting it together. I've never worked with absolute bleeding edge Rails like this before, so this is really useful.

Collapse
 
adrienpoly profile image
Adrien Poly

Thanks it was a BIG discovery for me too ๐Ÿ˜€