我正在关注michael harlt rails教程,但是我收到了这个错误
缺少模板布局/邮件使用{:locale => [:en],:formats => [:html],:variants => [],:handlers => [:raw,:erb,:html,:builder,:红宝石,:咖啡,:jbuilder]}.搜索:*"/ home/ubuntu/workspace/app/views"
预览帐户激活时
这是我的user_mailer.rb
class UserMailer < ApplicationMailer
def account_activation(user)
@user = user
mail to: user.email, subject: "Account activation"
end
def password_reset
@greeting = "Hi"
mail to: "to@example.org"
end
end
Run Code Online (Sandbox Code Playgroud)
并且错误突出显示的行
mail to: user.email, subject: "Account activation"
Run Code Online (Sandbox Code Playgroud)
我尝试在user_mailer.rb中添加layout'mailer',但它不起作用.
编辑: 这是错误的屏幕截图
我正在研究Michael Hartl的Ruby on Rails教程,并且我添加了代码来显示用户的Gravatar图像.但它没有显示.
这是我的用户帮助
module UsersHelper
# Returns the Gravatar (http://gravatar.com/) for the given user.
def gravatar_for(user)
gravatar_id = Digest::MD5::hexdigest(user.email.downcase)
gravatar_url = "https://secure.gravatar.com/avatar/#{gravatar_id}"
image_tag(gravatar_url, alt: user.name, class: "gravatar")
end
end
Run Code Online (Sandbox Code Playgroud)
这是我的show.html.erb
<% provide(:title, @user.name) %>
<div class="row">
<aside class="col-md-4">
<section class="user_info">
<h1>
<%= gravatar_for @user %>
<%= @user.name %>
</h1>
</section>
</aside>
</div>Run Code Online (Sandbox Code Playgroud)
这是我检查元素时的代码
<img alt="humber" class="gravatar" src="https://secure.gravatar.com/avatar/8e92292186fbb306e253b08d0f3eb993">
humber
Run Code Online (Sandbox Code Playgroud)
当我运行heroku run rake db:migrate in production时,我收到此错误.DEPRECATION WARNING:config.serve_static_files已弃用,将在Rails 5.1中删除.请config.public_file_server.enabled = true改用.(从/app/config/environments/production.rb:25中的块调用)
我在stackoverflow上尝试了一些解决方案,但我无法解决问题.
这是我的production.rb文件
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# Code is not reloaded between requests.
config.cache_classes = true
# Eager load code on boot. This eager loads most of Rails and
# your application in memory, allowing both threaded web servers
# and those relying on copy on write to perform better.
# Rake tasks automatically ignore this option …Run Code Online (Sandbox Code Playgroud)