Migrate tags in Rails to PostgreSQL array from ActsAsTaggableOn

ActsAsTaggableOn is a swiss army knife solution if you need to add tags to your ActiveRecord model.Just by adding one gem to your Gemfile and acts_as_taggable to the model you get everything you need: adding tags, searching for a model by tag, getting top tags, etc. However, sometimes you don't need all these.In our project, we used acts_as_taggable to store tags for Note model. Then we displayed a list of notes on several pages with assigned tags and had autocompleted input for tags on Note form. Everything worked well, but since we use PostgreSQL, I decided to store tags as an array in Note model.First of all, I added tags Array column to Note, after this migrated actsastaggable tags to notes table with migration.
Migrate tags in Rails to PostgreSQL array from ActsAsTaggableOn #ruby #rubydeveloper #rubyonrails #array https://rubyonrails.ba/single/migrate-tags-in-rails-to-postgresql-array-from-actsastaggableon

Nezir Zahirovic

Contractor Ruby On Rails (8+ years) / MCPD .Net / C# / Asp.Net / CSS / SQL / (11 years)

related articles