Hi,

I'm not an expert, but I had also plenty of problems with Rails db
connections in the beginning, almost every time another solution
solved my problems.

First: if you try "rails -v" or "rails --version" you have to see some
version number. It is important, if you cannot (like I did not), than
reinstall is the solution. (I assumed that you use Unix based system)

It is also useful, because of (as I know) the "-d ..." syntax changed,
In earlier versions it was "-d=..." (or like this but Im not sure
about it, it is unnecessary to know, but it can be problem, if you do
not update! ;))

Next problem can be with db connection:
1. connection in .yaml, (now it seems ok);
2. name+pw (it seems ok);
3. is the db server running?

If you can change the db manually, than the .yaml have to has the
problem - also check the port, socket, other infos, it differs for
different dbs!
If you cannot, than first fix that, than dont forget the .yaml!

For me it helped a lot not to change the basic database setup, so just
used it without "-d ..." and later, when understand a bit more, I
could figure it out.

This blog app just confused me like hell, but I found a very useful
staff from Pragprog:
http://www.pragprog.com/titles/rails4/agile-web-development-with-rails

good luck,
gezope

On aug. 19, 17:16, "Ivan K." <[email protected]> wrote:
> Hello;
>
> I have begun the "Getting Started with Rails" guide 
> athttp://guides.rubyonrails.org/getting_started.html
> which is supposed to create a simple blog.
>
> I execute the command "rails blog -d postgresql" without incident.
>
> I am having trouble with the next command in the tutorial:
> "rake db:create".
>
> The first time, I received the messages:
>
>    FATAL:  role "blog" does not exist
>    ...
>    Couldn't create database for {"encoding"=>"unicode",
> "username"=>"blog",
>       "adapter"=>"postgresql", "database"=>"blog_development",
>       "pool"=>5, "password"=>"xxxxyyy"}
>
> So I created the postgres account blog and gave that account the
> ability to create databases and users.  Now that same command
> ""rake db:create"" yields these messages:
>
>    undefined method `quote_ident' for PGconn:Class
>    ...
>    Couldn't create database for {"encoding"=>"unicode",
> "username"=>"blog",
>       "adapter"=>"postgresql", "database"=>"blog_development",
>       "pool"=>5, "password"=>"xxxxyyy"}
>
> So what is the issue here?  Should I have created the three
> user accounts before hand?
>
> Could I just create the "blog" database before hand at the
> postgres prompt?  If so, are there any tables that the
> "rails blog -d postgresql" creates?
>
> Thank you for your help.
>
> P.S. my config/database.yml looks like this:
>
> development:
>   adapter: postgresql
>   encoding: unicode
>   database: blog_development
>   pool: 5
>   username: blog
>   password: xxxxyyy
>
> test:
>   adapter: postgresql
>   encoding: unicode
>   database: blog_test
>   pool: 5
>   username: blog
>   password: xxxxyyy
>
> production:
>   adapter: postgresql
>   encoding: unicode
>   database: blog_production
>   pool: 5
>   username: blog
>   password: xxxxyyy

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to