A newbie working through the getting started guide.

Hi all,

At the beginning of the year I decided to take up coding. I’ve heard that RoR is a great way to start, and so my searches led me to the getting started guide on the rubyonrails website. I started working through the getting started guide today and came across two points in which I experienced problems.

Problem 1.) When executing the rake db:create command I received the following error:

Michaels-MacBook:config username$ rake db:create (in /Users/username/Documents/experiments/blog) rake aborted! Please install the postgresql adapter: gem install activerecord-postgresql-adapter (pg is not part of the bundle. Add it to Gemfile.) /Users/username/.rvm/gems/ruby-1.9.3-p385@global/gems/bundler-1.2.4/lib/bundler/rubygems_integration.rb:147:in block in replace_gem' /Users/username/.rvm/gems/ruby-1.9.3-p385/gems/activerecord-3.2.12/lib/active_record/connection_adapters/postgresql_adapter.rb:7:in <top (required)>’ /Users/username/.rvm/gems/ruby-1.9.3-p385/gems/activesupport-3.2.12/lib/active_support/dependencies.rb:251:in require' /Users/username/.rvm/gems/ruby-1.9.3-p385/gems/activesupport-3.2.12/lib/active_support/dependencies.rb:251:in block in require’ /Users/username/.rvm/gems/ruby-1.9.3-p385/gems/activesupport-3.2.12/lib/active_support/dependencies.rb:236:in load_dependency' /Users/username/.rvm/gems/ruby-1.9.3-p385/gems/activesupport-3.2.12/lib/active_support/dependencies.rb:251:in require’ /Users/username/.rvm/gems/ruby-1.9.3-p385/gems/activerecord-3.2.12/lib/active_record/connection_adapters/abstract/connection_specification.rb:50:in resolve_hash_connection' /Users/username/.rvm/gems/ruby-1.9.3-p385/gems/activerecord-3.2.12/lib/active_record/connection_adapters/abstract/connection_specification.rb:29:in spec’ /Users/username/.rvm/gems/ruby-1.9.3-p385/gems/activerecord-3.2.12/lib/active_record/connection_adapters/abstract/connection_specification.rb:130:in establish_connection' /Users/username/.rvm/gems/ruby-1.9.3-p385/gems/activerecord-3.2.12/lib/active_record/railties/databases.rake:90:in create_database’ /Users/username/.rvm/gems/ruby-1.9.3-p385/gems/activerecord-3.2.12/lib/active_record/railties/databases.rake:62:in block (3 levels) in <top (required)>' /Users/username/.rvm/gems/ruby-1.9.3-p385/gems/activerecord-3.2.12/lib/active_record/railties/databases.rake:62:in each’ /Users/username/.rvm/gems/ruby-1.9.3-p385/gems/activerecord-3.2.12/lib/active_record/railties/databases.rake:62:in block (2 levels) in <top (required)>' /Users/username/.rvm/gems/ruby-1.9.3-p385/bin/ruby_noexec_wrapper:14:in eval’ /Users/username/.rvm/gems/ruby-1.9.3-p385/bin/ruby_noexec_wrapper:14:in `’ Tasks: TOP => db:create (See full trace by running task with --trace)

I attempted to execute the command gem install activerecord-postgresql-adapter to fix the problem, and as far as I can tell the gem install happens with no problem. I don’t know if this issue affects the second issue I’m having right now.

2.) After successfully starting my server and viewing the “Welcome Aboard” page, I execute the command to generate the controller home index, write in html to the index.html.erb file, execute the code to remove the public/index.html file, and uncomment the specified line in my routes.rb file (unlike the guide, the line in my routes.rb file reads "root :to => ‘welcome#index’ "). I save and when I try to navigate to my localhost:3000 page, I get the following error:

I’m really not sure what is going on here. I did my best to follow the instructions exactly as specified on the guide, but as far as I can tell either postgresql is the source of my problem or there is something that I am not understanding in the guide.

Thanks in advance for the help!

~Michael Vezzani

The error says “pg is not part of the bundle.” Please follow the steps:

1: Add to Gemfile: gem ‘pg’ 2: Run from command line: bundle install 3: Start server and check URL again.

When getting errors, it helps to Google the error first because most issues have already been answered.

Thanks, Evan

It is better to stick with SQLite for learning. Setting up other databases is beyond the scope of the guide and it is not trivial if you are not familiar with them. SQLite works out of the box and allows you to focus on the subject.

The revised guide for Rails 4 no longer mentions other databases by the way.