I want to make a simple user notification in rails with just text. I want there to be multiple notifications obviously so my question is do I have to create a whole new migration and create an association with my User model or is there some way to just extend a “notifications” text attribute in my User table? I guess you can just insert line breaks in between notifications but that’s not what I’m looking for as that sounds like it would get too messy. Thanks!
Share
If you just want to store notifications only you can tell Rails to treat it as an Array (notifications’ column type should be
text):If you want to store any additional notification details (like author or timestamps or whatever) you should probably go for a separate model.
Rails docs: Active Record, search for “Saving arrays, hashes, and other non-mappable objects in text columns”.