Estoy intentando utilizar actionmailer para notificarme cuando un nuevo comentario se ha publicado, pero sigo obteniendo el error:Rails 3 Acción Mailer sin inicializar constantes
uninitialized constant CommentsController::CommentMailer
Se añade el comentario a mi base de datos y puede ser visto. También estoy usando el dispositivo y sus funciones de correo electrónico funcionan bien.
Mi comentario Mailer:
class CommentMailer < ActionMailer::Base
def newcomment(comment)
mail(:to => "[email protected]", :subject => "New Comment")
end
end
y mi sección del controlador:
def create
@comment = Comment.new(params[:comment])
@comment.user_id = current_user.id
respond_to do |format|
if @comment.save
CommentMailer.newcomment(@comment).deliver
format.html { redirect_to @comment, notice: 'Comment was successfully created!' }
format.json { render json: @comment, status: :created, location: @comment }
else
format.html { render action: "new" }
format.json { render json: @comment.errors, status: :unprocessable_entity }
end
end
end
Su mensaje de error dice "CommentsMailer" con una s mientras que su código dice CommentMailer. ¿El error definitivamente proviene de este código? ¿Puedes identificar la línea de donde proviene el error de stacktrace? – Shadwell
Lo siento, fue tarde cuando hice mi pregunta. es "CommentMailer" no "CommentsMailer" no "s" – Steve