Migrate tags in Rails to PostgreSQL array from ActsAsTaggableOn
01-Aug-2019 1498
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 #Migrate #Rails #PostgreSQL #array #ActsAsTaggableOn #array https://rubyonrails.ba/link/migrate-tags-in-rails-to-postgresql-array-from-actsastaggableon