问题描述
我是一个全新手(请阅读我的个人资料),并开始遵循Ruby on Rails教程,但库存一半。
I am a total novice (Please read my profile) and started following a Ruby on Rails tutorial but am stock half way.
本教程在这里
中途该页面,它开始介绍设计宝石。我安装了没有问题。
Halfway the page, it started introducing devise gem. Which I installed without a problem.
我按照说明直到
Devise还告诉我们检查五个步骤来完成设置:
I followed the instructions up to "Devise also told us to check five steps to complete the setup:"
我不明白该做什么/在哪里添加以下步骤
I don't understand what to do / where to add the following steps
1)在config /的routes.rb。现在,我们可以通过将BookmarksController#index指向站点根目录来实现:
1)define a root_url in config/routes.rb. Fow now, we can achieve this by pointing BookmarksController#index to the root of the site:
书签:: Application.routes.draw做#[...]根'bookmarks#index'
Bookmarks::Application.routes.draw do # [...] root ‘bookmarks#index’
! routes.rb文件?在哪里?
我已经在文件的随机位置上复制了上面的代码,但我知道这不是写代码。因为有意见,而是意味着... [...]
请帮助
!What code do I exactly put inside the routes.rb file? and where? I have copy pasted the above in a random location in the file but I am aware this is not the write code. As there are comments and there is meant to be something instead on [...]PLEASE HELP
2)将两个html添加到应用/景色/布局/ application.html.erb。这个文件是您的Rails应用程序的主要布局。
2)add the two pieces of html in app/views/layouts/application.html.erb. This file is the main layout your Rails app.
!我需要输入哪些HTML代码?那代码是什么?我找不到任何代码插入
!Where are the HTML codes I need to enter? And what is that code? I cannot find any codes to insert
您的帮助真的非常感激。
Your help is really really appreciated.
谢谢
Sam
Thank youSam
推荐答案
- 打开
config / routes.rb
并添加root:to => bookmarks#index
- Open
config/routes.rb
and addroot :to => "bookmarks#index"
config / routes.rb
Rails.application.routes.draw do
root :to => "bookmarks#index"
end
- 在
app / views / layouts / application.html.erb中添加两个html
- Add the two pieces of html in
app/views/layouts/application.html.erb
app / views / layouts / application.html.erb
<!DOCTYPE html>
<html>
<head>
<title>Beautify</title>
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>
<%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
<%= csrf_meta_tags %>
</head>
<body>
<!-- two pieces -->
<p class="notice"><%= notice %></p>
<p class="alert"><%= alert %></p>
<!-- end two pieces -->
<%= yield %>
</body>
</html>
:)
这篇关于Ruby on rails教程:route_url和HTML - 我是库存的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!