Rick Tessner

Joined

1,680 Experience
16 Lessons Completed
0 Questions Solved

Activity

Posted in How to use Dev Containers with Rails Discussion

Dang it. Missed your comment about the devcontainer CLI so using vim / neovim etc will work. Just not as seamless as VScode.

Posted in How to use Dev Containers with Rails Discussion

This looks great. Is the only reason VScode is required due to the devcontainer plugin? I ask because for the past year or so I've gone full neovim. It looks like there are some attempts at a devcontainer plugin there as well.

Would you happen to have tried the neovim devcontainer plugin(s)? If so, how well did it work?

Interesting. I don't use S3.

What would a more generic solution be that would apply equally to other storage options, including just local file storage?

Hi all,

With carrierwave etc it was easy enough to associate a User with an uploaded image. Things are a bit different with ActiveStorage::Attachment & Blobs.

For example, suppose I have aPark models that has_many_attached :images. I also have a User model and any user can upload an image. I want folk to be able to delete their own images that they've uploaded but not other peoples images.

I can see two ways of doing this:

  • Create a separate model, say Image that belongs_to :user and has_one_attached :picture and then Park instead of having has_many_attachments, just has_many :images
  • Make use of the fact that ActiveStorage::Blob has many ActiveStorage::Attachment and do the ownership of a blob by having two ActiveStorage::Attachment records: One for the Park and the other for the User.

How are people handling ownership of uploaded blobs? Are there other ways of doing this? Is there a best practice around this? Has Chris done a video on this that I've not yet seen?

Thanks all!

Rick