小编Alb*_*Alb的帖子

"PG DuplicateTable:错误关系"产品"已经存在" - Heroku db:迁移尝试

Rails新手试图将DB迁移到heroku.请原谅这个错误信息的多汁性,但我认为将它包括在内可能很重要.我不知道为什么会这样或者意味着什么.我的架构中只有一个产品表,另一个创建产品迁移.

Migrating to CreateProducts (20140804010848)
== 20140804010848 CreateProducts: migrating ===================================
-- create_table(:products)
PG::DuplicateTable: ERROR:  relation "products" already exists
: CREATE TABLE "products" ("id" serial primary key, "name" character varying(255), "price" float, "description" text, "image" character varying(255), "color" character varying(255), "created_at" timestamp, "updated_at" timestamp) 
rake aborted!
StandardError: An error has occurred, this and all later migrations canceled:

PG::DuplicateTable: ERROR:  relation "products" already exists
: CREATE TABLE "products" ("id" serial primary key, "name" character varying(255), "price" float, "description" text, "image" character varying(255), …
Run Code Online (Sandbox Code Playgroud)

postgresql ruby-on-rails heroku

5
推荐指数
1
解决办法
8324
查看次数

缺少所需的密钥

Rails新秀在这里.尝试从导航栏中的图像链接到购物车显示页面.代码:

<%= link_to(image_tag("cart.png"),cart_path) %> 
Run Code Online (Sandbox Code Playgroud)

给我这个错误:

No route matches {:action=>"show", :controller=>"carts"} missing required keys: [:id]
Run Code Online (Sandbox Code Playgroud)

我的推车控制器从这开始:

def show
   begin
     @cart = Cart.find(params[:id]) 
Run Code Online (Sandbox Code Playgroud)

你向导的任何见解都会很棒.

ruby ruby-on-rails

1
推荐指数
1
解决办法
3834
查看次数

居中图像并将其保留在底部

我在将图像保留在侧边栏底部时遇到问题。当我能够将其居中时,它想要加入较高的链接并且不会下降,而当我将其强制到底部时,我无法在没有危险的边距黑客的情况下使其居中。

.sidebar {
  height: 100vh;
  max-width: 25%;
  float: left;
  font-family: 'Pontano Sans', sans-serif;
  position: fixed;
 }

  .sidebar li:nth-of-type(1) {
        padding-top: 10%;
      }


.sidebar li {
  color: #8B2500;
  margin-top: 40px;
  list-style: none;
  text-align: center;
  margin-left: -35px;
  font-size: 20px;
}
  #add {
    display: block;
    margin: 0 auto;
    bottom: 0;
    position: absolute;
    width: 80px;
    height: 80px;
  }
Run Code Online (Sandbox Code Playgroud)

html:

<nav class="sidebar"><img class="logo" src="images/logo.png"></img>
            <ul>
                <li> <a href="#"> About </a></li>
                <li> <a href="docs.html"> Providers </a></li>
                <li> <a href="#"> Quality </a> </li>
                <li> <a href="#"> Contact …
Run Code Online (Sandbox Code Playgroud)

html css

0
推荐指数
1
解决办法
660
查看次数

标签 统计

ruby-on-rails ×2

css ×1

heroku ×1

html ×1

postgresql ×1

ruby ×1