database.yml的:
# SQLite version 3.x
# gem install sqlite3
#
# Ensure the SQLite 3 gem is defined in your Gemfile
# gem 'sqlite3'
development:
adapter: postgresql
encoding: utf8
database: sampleapp_dev #can be anything unique
#host: localhost
#username: 7stud
#password:
#adapter: sqlite3
#database: db/development.sqlite3
pool: 5
timeout: 5000
# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development …Run Code Online (Sandbox Code Playgroud) 我安装了prostgres以与我的rails4应用程序一起使用,我能够连接到数据库服务器并创建数据库.然后我对我的Gemfile和config/database.yml进行了必要的更改以使用postgres.然后我创建了一个新的应用程序,并在应用程序中创建了一个用户模型:
$ rails generate model User name:string email:string
invoke active_record
create db/migrate/20130806145935_create_users.rb
create app/models/user.rb
invoke rspec
create spec/models/user_spec.rb
Run Code Online (Sandbox Code Playgroud)
然后我做了:
$ bundle exec rake db:migrate
== CreateUsers: migrating ====================================================
-- create_table(:users)
-> 0.1498s
== CreateUsers: migrated (0.1500s) ===========================================
Run Code Online (Sandbox Code Playgroud)
但是在db目录中,我看到了这些文件:
development.sqlite3
test.sqlite3
Run Code Online (Sandbox Code Playgroud)
此外,当我尝试使用SQLite数据库浏览器查看这些文件时,我收到一条错误消息,指出它们不是sqlite 3数据库.事实上,它们是空的:
~/rails_projects/sample_app4_0/db$ ls -al
total 40
drwxr-xr-x 8 7stud staff 272 Aug 6 22:50 .
drwxr-xr-x 24 7stud staff 816 Aug 6 22:23 ..
-rw-r--r-- 1 7stud staff 0 Jul 30 00:21 development.sqlite3
drwxr-xr-x 3 7stud staff 102 Aug …Run Code Online (Sandbox Code Playgroud) 我是Rails的新手,我刚刚完成了我正在开发的应用程序的一部分,我想知道数据库文件在哪里,我无法在rails.root目录中找到它.有没有人有答案?
提前致谢.
编辑:我正在搜索文件而不是配置文件,我正在使用PostgreSQL和Ubuntu