mysql - Best way to store an array of data associated with a post in Rails -


so have mysql-powered rails app has post model, , want each post have list of keyword associated it. keywords specific , rare 1 keyword shared between 2 posts.

there 3 options here:

  1. a comma separated list in "keywords" attribute
  2. have serialized array in "keywords" attribute
  3. build keyword model , store each keyword under own record , associate them posts id

which best solution , why?

if want search tags, 3, because otherwise have or instantiate every object in search, or sql query ugly.

if don't want query tags, serialize make readable , avoid table (and eager loading) that.


Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -