我的问题是生成URL.我正在使用url_for
class Template < ApplicationRecord acts_as_archival Readonly_when_archived: true before_archive belongs_to :user has_many :fIElds,dependent: :destroy accepts_nested_attributes_for :fIElds,allow_destroy: true has_many :contracts has_one_attached :imageend<%= url_for(@template.image) %>
我有这个错误
undefined method `active_storage_attachment_path' for#<#<Class:0x007fa1de477520>:0x007fa1defa8b88>解决方法 你可以尝试使用
@template.image.url
资料来源:http://www.rubydoc.info/gems/activestorage/0.1
总结以上是内存溢出为你收集整理的ruby-on-rails – ActiveStorage生成附件网址全部内容,希望文章能够帮你解决ruby-on-rails – ActiveStorage生成附件网址所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)