小编use*_*293的帖子

ActiveRecord :: AdapterNotSpecified数据库配置未指定适配器

当我使用heroku打开我的网络应用程序工作正常,但当我使用rails(localhost)时,我遇到了这个错误:

ActiveRecord::AdapterNotSpecified database configuration does not specify adapter
Run Code Online (Sandbox Code Playgroud)

为什么是这样?

这是我的database.yml

# PostgreSQL. Versions 8.2 and up are supported.
#
# Install the pg driver:
#   gem install pg
# On OS X with Homebrew:
#   gem install pg -- --with-pg-config=/usr/local/bin/pg_config
# On OS X with MacPorts:
#   gem install pg -- --with-pg-config=/opt/local/lib/postgresql84/bin/pg_config
# On Windows:
#   gem install pg
#       Choose the win32 build.
#       Install PostgreSQL and put its /bin directory on your path.
#
# Configure Using Gemfile …
Run Code Online (Sandbox Code Playgroud)

ruby postgresql activerecord heroku ruby-on-rails-4

31
推荐指数
3
解决办法
6万
查看次数

PG :: ConnectionBad FATAL:角色"Myname"不存在

我正在尝试使用PostgreSQL,以便我可以部署到Heroku.但是我不能再运行localhost了么?我收到以下消息:

PG::ConnectionBad
FATAL: role "Myname" does not exist
Run Code Online (Sandbox Code Playgroud)

这是我的databse.yml

development:
  adapter: postgresql
  database: my_database_development
  pool: 5
  timeout: 5000

test:
  adapter: postgresql
  database: my_database_test
  pool: 5
  timeout: 5000

production:
  adapter: postgresql
  database: my_database_production
  pool: 5
  timeout: 5000 
Run Code Online (Sandbox Code Playgroud)

这是我的gemfile:

source 'https://rubygems.org'

# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.0.3'

# Use pg as the database for Active Record
gem 'pg'

# Use SCSS for stylesheets
gem 'sass-rails', '~> 4.0.0'

# Use Uglifier as compressor for JavaScript assets
gem …
Run Code Online (Sandbox Code Playgroud)

postgresql ruby-on-rails localhost heroku ruby-on-rails-4

21
推荐指数
3
解决办法
2万
查看次数

检查元素不工作/空白

每当我尝试检查元素时,什么也没有出现。我在 Chrome 上。我得到了

Elements | Network | Sources | Timeline | Profiles | Resources | Audits | Console
Run Code Online (Sandbox Code Playgroud)

菜单,然后是以下每个菜单中的子菜单:

Console | Search | Emulation | Rendering
Run Code Online (Sandbox Code Playgroud)

我去哪里查看源代码?以前我只是检查元素,它就会出现,我是否不小心搞乱了配置?

谢谢!

html css frontend web-inspector twitter-bootstrap-3

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

耙子流产了!PG :: ConnectionBad:fe_sendauth:没有提供密码任务:TOP => db:migrate(通过使用--trace运行任务来查看完整跟踪)

尝试时,我得到以下内容 rake db:migrate

rake aborted!
PG::ConnectionBad: fe_sendauth: no password supplied

Tasks: TOP => db:migrate
(See full trace by running task with --trace)
Run Code Online (Sandbox Code Playgroud)

转到我的localhost时,我也收到类似的消息

fe_sendauth: no password supplied
Run Code Online (Sandbox Code Playgroud)

我的rails服务器和rails控制台也不起作用

我一直在尝试一些事情,这就是我的gemfile目前的样子:

source 'https://rubygems.org'
ruby '2.0.0'

# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.0.3'

# Use SCSS for stylesheets
gem 'sass-rails', '~> 4.0.0'

# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'

# Use CoffeeScript for .js.coffee assets and views
gem 'coffee-rails', '~> 4.0.0'

# See …
Run Code Online (Sandbox Code Playgroud)

postgresql ruby-on-rails heroku ruby-on-rails-4

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

部署到Heroku(表不存在错误)

我正在构建一个示例预注册页面,人们可以在应用程序启动之前注册他们的电子邮件.当我输入时:

heroku open
Run Code Online (Sandbox Code Playgroud)

我的浏览器出现以下错误

We're sorry, but something went wrong.

If you are the application owner check the logs for more information.
Run Code Online (Sandbox Code Playgroud)

检查我的日志后,我发现了这个奇怪的错误:

[36m2014-04-28T08:22:01.921791+00:00 app[web.1]:?[0m PG::UndefinedTable: ERROR:
 relation "premails" does not exist
Run Code Online (Sandbox Code Playgroud)

那是什么意思?我有以下迁移:

class CreatePremails < ActiveRecord::Migration
  def change
    create_table :premails do |t|

        t.text :email

      t.timestamps
    end
  end
end
Run Code Online (Sandbox Code Playgroud)

和型号:

class Premail < ActiveRecord::Base

end
Run Code Online (Sandbox Code Playgroud)

如何在Heroku上部署它需要做什么?我不确定这是不是问题,或者我是否需要更改我的database.yml文件.目前我在那里有这个:

# SQLite version 3.x
#   gem install sqlite3
#
#   Ensure the SQLite 3 gem is defined in your Gemfile
#   gem 'sqlite3'
development: …
Run Code Online (Sandbox Code Playgroud)

database ruby-on-rails heroku ruby-on-rails-4

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

身体标签边缘创建坏空白顶部

我无法摆脱页面顶部正文标签上的白边.我将添加必要的.body格式,但它仍然存在,我的检查器仍然显示默认的8px填充由于某种原因.为什么身体不会捡起来?

@import "bootstrap";
@import url(http://fonts.googleapis.com/css?family=Lato|Open+Sans+Condensed:300);


.body {
    margin:0px;
}

.container-top {
    text-align: center;
    font-family: 'Open Sans Condensed', sans-serif;
    background-color: #424b51;
    font-size: 25px;
}
Run Code Online (Sandbox Code Playgroud)

html css twitter-bootstrap twitter-bootstrap-3

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