在 Devise 和 Forem 的帮助下,我正在基于 Michael Hartl 的 Ruby on Rails 教程进行开发。该代码在https://github.com/fchampreux/ODQ_Web可见。该网站可见于http://www.opendataquality.org
在我的标题中,我包含了一张图片:
<header>
...
<div class="row">
<div class="col-md-3">
<h5><img style="position:relative; left:10px; top:10px; vertical-align:bottom" alt="ODQ Logo" src="assets/ODQ_Logo.png"></h5>
</div>
...
它工作正常,并为我的每个页面生成以下 html 代码:
<img style="position:relative; left:10px; top:10px; vertical-align:bottom" alt="ODQ Logo" src="assets/ODQ_Logo.png">
所有静态页面都在一个专用文件夹中,由 static_pages_controller 生成。他们每个人都正确地渲染了图像。
Forem 生成的动态页面不渲染图像。此页面实际上并未直接列在 routes.rb 或控制器中。
路线.rb
ODQWeb::Application.routes.draw do
# This line mounts Forem's routes at /forums by default.
# This means, any requests to the /forums URL of your application will go to Forem::ForumsController#index.
# If you would like to change where this extension is mounted, simply change the :at option to something different.
#
# We ask that you don't use the :as option here, as Forem relies on it being the default of "forem"
mount Forem::Engine, :at => '/forums'
devise_for :users
# The priority is based upon order of creation: first created -> highest priority.
# See how all your routes lay out with "rake routes".
# You can have the root of your site routed with "root"
root to: 'static_pages#welcome'
get '/welcome', to: 'static_pages#welcome'
get '/partners', to: 'static_pages#partners'
get '/careers', to: 'static_pages#careers'
get '/products', to: 'static_pages#products'
get '/services', to: 'static_pages#services'
get '/solutions', to: 'static_pages#solutions'
end
Forem 初始化程序配置为应用程序布局:
配置/初始化程序/forem.rb
Rails.application.config.to_prepare do
Forem.layout = "application"
end
你能帮我理解和解决这个问题吗?