ruby-on-rails - 重新提交 accepts_attachments_for issue

标签 ruby-on-rails ruby image refile

我将 Refile 与 Rails 4 应用程序一起使用。

我收到错误:undefined methodaccepts_attachments_for'`

我正在尝试上传多张图片,并且有两种模型:书籍和 blob。

我的书.rb:

has_many :blobs, dependent: :destroy
accepts_attachments_for :blobs

我的 blobs.rb:

belongs_to :book
attachment :file

如果我检查 rake 路由,它显示 refile 已挂载,那么问题是什么?

最佳答案

此处讨论了您要使用的功能:https://github.com/refile/refile/issues/6而且它似乎还没有发布。如果你想使用它,你需要使用 master 分支。您可以通过更改 Gemfile 来尝试使用 master 分支:

gem 'refile', require: "refile/rails", git: 'https://github.com/refile/refile.git', branch: 'master'

关于ruby-on-rails - 重新提交 accepts_attachments_for issue,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31167052/

相关文章:

ruby - 如何从 ruby​​ 上的 CSV 文件读取特定单元格值并输出结果?

ruby - YAML/ ruby : Get the first item whose <field> is <value>?

jquery - jquery 中的图像 native 宽度

mysql - 设置 Rails 以查找 LIBMYSQL.dll 的默认位置

ruby-on-rails - 仅当 URL 中存在参数时,Rails will_paginate 使用 :conditions,

ruby-on-rails - Mysql2 (rails 3) 的未定义方法 `next_result'

ruby-on-rails - 在 ERB 内联代码中获取第一个非 nil 数组值

ruby-on-rails - 如何在 Ruby 变量名中使用字符串?

html - 在悬停时更改图像和文本并单击

python - 如何在不保存的情况下在python窗口中显示图像/屏幕截图