【文件属性】:
文件名称:refile-mongoid:重新提交与Mongoid的集成
文件大小:8KB
文件格式:ZIP
更新时间:2021-04-28 18:13:05
Ruby
将与集成。
安装
将此行添加到您的应用程序的Gemfile中:
gem 'refile-mongoid'
然后执行:
$ bundle
或将其自己安装为:
$ gem install refile-mongoid
用法
Se原始归档文档以供使用。
您只需要创建数据库迁移,因为在模型上自动定义了附件ID字段。
在嵌入式文档中使用附件
由于文件的存储/删除是由回调触发的,因此您可能需要为您的嵌入式关联指定cascade_callbacks: true ,例如:
class Photo
include Mongoid :: Document
attachment :image
end
class Album
include Mongoid :: Document
embeds_many :photos , cascade_callbacks : true
end
请
【文件预览】:
refile-mongoid-master
----LICENSE.txt(1KB)
----refile-mongoid.gemspec(1KB)
----lib()
--------refile()
----Gemfile(112B)
----spec()
--------mongoid_helper.rb(199B)
--------refile_helper.rb(1KB)
--------spec_helper.rb(112B)
--------refile()
----Rakefile(117B)
----.travis.yml(68B)
----README.md(1KB)
----.rspec(28B)
----.gitignore(126B)