Hello, beginner/intermediate here as well, learnin...
# support
c
Hello, beginner/intermediate here as well, learning a lot as I go. I'm testing adding an input for vacation days for a store. I want to be able to update a Store model with an array of dates (['2022-10-31', '2022-11-27']) I've: -Done the migration -Added the new attributes to permitted attributes in the Spree initializer. -Added a little shim to serialize the database text column as an array to the Spree::Store model. -Then defaced the admin view to add the columns. This looks fine (schema, no errors on boot, or when I update the Store via the new view). But, when I go to save the store with a test array, it's not saving the new columns. Am I missing something?
Ah, I think it must be related to the "shim" I mentioned. I'll keep trying to play around to get it working following this guide: https://guides.solidus.io/customization/customizing-the-core#using-overrides
Ah, this worked! Is there a prettier or more ideal way to do this?
w
Are you using Postgres? If so, you can use the
array
type: https://guides.rubyonrails.org/active_record_postgresql.html#array
c
Yup, I partially was just trying to figure out how to be able to modify/extend the controller and model logic. But, yeah I ended up not needing that at all. I think I just didn't do a server restart after appending to permitted_params or something. Working fine now, thanks!
w
👍 yeah, prepend is the less unobtrusive way of modifying the core logic