Ruby on rails 在通过img src';之前的ActionMailer;导航到新邮件时出现错误
通知控制器:Ruby on rails 在通过img src';之前的ActionMailer;导航到新邮件时出现错误,ruby-on-rails,ruby,actionmailer,Ruby On Rails,Ruby,Actionmailer,通知控制器: class NotificationsController < ApplicationController before_action :set_notification, only: [:show, :edit, :update, :destroy] # GET /notifications # GET /notifications.json def index @notifications = Notification.all end
class NotificationsController < ApplicationController
before_action :set_notification, only: [:show, :edit, :update, :destroy]
# GET /notifications
# GET /notifications.json
def index
@notifications = Notification.all
end
# GET /notifications/1
# GET /notifications/1.json
def show
end
# GET /notifications/new
def new
@notification = Notification.new
end
.
.
.
private
# Use callbacks to share common setup or constraints between actions.
def set_notification
@notification = Notification.find(params[:id])
end
# Never trust parameters from the scary internet, only allow the white list through.
def notification_params
params.require(:notification).permit(:name, :email, :subject, :text)
end
end
为什么要调用NotificationsController#show(以两个照片源作为参数),为什么要设置?如果只调用“新建”操作,为什么要调用通知 从视图中生成错误。可能您正在尝试设置基于直接路径的图像。 使用rails资产助手方法,如
<%= image_tag asset_path("myimage.jpg"), size: '200x200', class: 'img-responsive' %>
它将使用文件夹(app/assets/images)中图像的资产路径,并将使用编译的资产进行开发和生产)
希望这有帮助…从视图中生成错误。可能您正在尝试设置基于直接路径的图像。 使用rails资产助手方法,如
<%= image_tag asset_path("myimage.jpg"), size: '200x200', class: 'img-responsive' %>
它将使用文件夹(app/assets/images)中图像的资产路径,并将使用编译的资产进行开发和生产)
希望这有助于…您将链接放在哪里。它似乎是在获取另一个对象的ID,这就是为什么您看到这些对图像的请求。您将链接放在哪里。它似乎是在获取另一个对象的ID,这就是为什么您会看到这些对图像的请求。