【问题标题】:Having trouble extending ActiveStorage::Attachment with acts_as_list使用acts_as_list 扩展ActiveStorage::Attachment 时遇到问题
【发布时间】:2021-04-27 21:04:35
【问题描述】:

有人可以提供将acts_as_list 添加到活动存储附件的最佳做法吗? gem 需要将“acts_as_list”添加到相关模型中。我对编辑 gems 目录中的 ActiveStorage 模型犹豫不决,但我是扩展 ruby​​/rails 的新手。

所有这一切都是关于我为附加图像添加排序的编码地狱!

【问题讨论】:

    标签: ruby-on-rails acts-as-list


    【解决方案1】:

    据我所知,扩展ActiveStore 类并不是一个好主意,因为这将扩展它以供您使用。我看到了一个建议,即在父模型中保留一组附件 id(有序)。您可以为此使用由jsonb 或类似内容支持的序列化列。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-10-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-09-06
      • 1970-01-01
      相关资源
      最近更新 更多