我正在安装过程中devise。我遵循了所有必需的步骤并在此结束:
$ rails generate devise User
$ rake db:migrate
Run Code Online (Sandbox Code Playgroud)
当我运行时,rake db:migrate出现以下错误:
$ rake db:migrate
== 20140618020442 AddDeviseToUsers: migrating =================================
-- change_table(:users)
rake aborted!
StandardError: An error has occurred, this and all later migrations canceled:
SQLite3::SQLException: duplicate column name: email: ALTER TABLE "users" ADD "em
ail" varchar(255) DEFAULT '' NOT NULLc:/appname/db/migrate/20140618020442_add_d
evise_to_users.rb:5:in `block in up'
c:/appname/db/migrate/20140618020442_add_devise_to_users.rb:3:in `up'
c:in `migrate'
Tasks: TOP => db:migrate
(See full trace by running task with --trace)
Run Code Online (Sandbox Code Playgroud)
我的项目具有以下数据库架构。部分devise迁移看似成功,但迁移并未完成。
ActiveRecord::Schema.define(version: 20140618020442) do …Run Code Online (Sandbox Code Playgroud) 我是Python的新手,非常喜欢它.然而,在执行某些代码时,我无法理解为什么某些变量通过点连接.
以下是从同一文件中取出的一些示例.
class Room(object):
def __init__(self, name, description):
self.name = name
self.description = description
self.paths = {}
def go(self, direction):
return self.paths.get(direction, None)
def add_paths(self, paths):
self.paths.update(paths)
Run Code Online (Sandbox Code Playgroud)
和
def test_room():
gold = Room("GoldRoom",
"""This room has gold in it you can grab. There's a
door to the north.""")
assert_equal(gold.name, "GoldRoom")
assert_equal(gold.paths, {})
Run Code Online (Sandbox Code Playgroud)
我不明白的事情是用点这样的人self.paths.update(paths)或 self.description等.
我不知道为什么要使用它,必须连接哪些变量以及何时必须使用它.
我在一个网站上工作,无论何时加载该网站或单击链接,它都会跳到底部。
当我从application.html.erb文件中删除页脚时,该站点没有滚动到底部。但我想保留页脚。有谁知道问题是什么或如何预防?
application.html.erb
<!DOCTYPE html>
<html>
<head>
<title>NightJobs</title>
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>
<%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
<%= csrf_meta_tags %>
<%= render 'layouts/shim' %>
</head>
<body>
<%= render 'layouts/header' %>
<div id="content"></div>
<div id="container">
<%= yield %>
</div>
<%= render 'layouts/footer' %>
</body>
</html>
Layouts _footer.html.erb
<nav class="footer">
<div class="footer-link-container">
<ul>
<li><%= link_to "Home", root_path,class: "link-new" %></li>
<li><%= link_to "Help", help_path,class: "link-new" %></li>
<li><%= link_to "Contact", contact_path,class: "link-new" %></li>
<li><%= link_to "About", about_path,class: …Run Code Online (Sandbox Code Playgroud)