Rails 没有这样的文件或目录@ rb_sysopen。无法从上传目录获取文件内容
Rails No such file or directory @ rb_sysopen. Can`t get file content from uploads directory
我已经用carrierwave保存了svg图标,试试把svg放到layout中?但我收到错误 "not such file"。我该怎么做?
帮手
def show_svg(path)
File.open(Rails.root.join(path), "rb") do |file|
raw file.read
end
end
查看
-@socLinks.each do |link|
%a{:href => link.link}
=show_svg link.icon_url.to_s
对我有用
def svg(path)
file_path = "#{Rails.root}/public#{path}"
return File.read(file_path).html_safe if File.exists?(file_path) '(not found)'
end
=svg link.icon_url.to_s
我已经用carrierwave保存了svg图标,试试把svg放到layout中?但我收到错误 "not such file"。我该怎么做?
帮手
def show_svg(path)
File.open(Rails.root.join(path), "rb") do |file|
raw file.read
end
end
查看
-@socLinks.each do |link|
%a{:href => link.link}
=show_svg link.icon_url.to_s
对我有用
def svg(path)
file_path = "#{Rails.root}/public#{path}"
return File.read(file_path).html_safe if File.exists?(file_path) '(not found)'
end
=svg link.icon_url.to_s