【问题标题】:rails 4.2, Paperclip, has_attached_filerails 4.2,回形针,has_attached_file
【发布时间】:2015-09-10 15:24:57
【问题描述】:

我检查了几个教程,但事情不工作。

Env 是 rails 4.2 和 Paperclip ~4.3。

当有一张图片时,我使用'has_attached_file :image_1',它可以工作。 尝试时,我需要再添加 1(也许 2)张图片:

has_attached_file :image_1 has_attached_file :image_2

接近并创建 2 个单独的表单条目,第二个图像未保存。

也许我要进入非设计方向,反正这个方向对我来说似乎很有意义。

【问题讨论】:

  • 你更新了你的强参数了吗? params.require(:model).permit(:image_1, :image_2)
  • 您是否为:image_2 添加了回形针列?
  • 运行rails generate paperclip YourModel image_2,然后更新YourModelController中允许的参数。

标签: ruby-on-rails ruby paperclip ruby-on-rails-4.2


【解决方案1】:

感谢提示。

Japed,是的,我“忘记”将 ':image_2' 添加到控制器的参数中。

btw rails 服务器日志显示 ~'unpermitted paremeter'。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2018-08-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-03-30
    • 1970-01-01
    • 2011-08-25
    • 2013-05-15
    相关资源
    最近更新 更多