Gem::Load error

hi everyone..
i install rails and all the things which is need for.
i create a new project
i create datbase's and set the database.yml file

but when i go to browser and type this=> localhost:3000. i get this
error=>

Gem::Loaderror

Specified 'postgresql' for database adapter, but the gem is not loaded.
Add `gem 'pg'` to your Gemfile (and ensure its version is at the minimum
required by ActiveRecord).

for fixing it i uninstall all the gems and reinstall all of them.
but again i have this error.

What does your Gemfile look like? Does it have the pg gem listed?

-James

James Jelinek (shakycode) wrote in post #1180882:

What does your Gemfile look like? Does it have the pg gem listed?

-James

i intsall pg gem and test again but it agian i get sampe problem.

Ok, but would you mind posting your Gemfile in a github gist so we can look at it? What happens when you run “bundle install” from the command line? Does it install all of the gems in your Gemfile?

-James

hi everyone..
i install rails and all the things which is need for.
i create a new project
i create datbase's and set the database.yml file

but when i go to browser and type this=> localhost:3000. i get this
error=>

Gem::Loaderror

Specified 'postgresql' for database adapter, but the gem is not loaded.
Add `gem 'pg'` to your Gemfile (and ensure its version is at the minimum
required by ActiveRecord).

for fixing it i uninstall all the gems and reinstall all of them.
but again i have this error.

I suggest you start by working right through a good tutorial such as
railstutorial.org (which is free to use online). This can be worked
through using a development environment in the cloud so there is no
need to worry about whether you have the right stuff installed on your
machine. Once you have worked through the tutorial you should have a
grasp of the basics or RoR and be ready to go with your own projects.
The couple of days spent will be very soon recovered in saved time
during the next phase of your learning.

Colin

James Jelinek (shakycode) wrote in post #1180884:

Ok, but would you mind posting your Gemfile in a github gist so we can
look at it? What happens when you run “bundle install” from the command
line? Does it install all of the gems in your Gemfile?

-James

bundle install work's perfectly and don't return any error.

Bundle complete! 12 Gemfile dependencies, 54 gems now installed.
Use `bundle show [gemname]` to see where a bundled gem is installed.

How about giving us the output of bundle list? Or at the very least bundle list pg?

PS If you see pg listed there you’re gonna have to give more information like the stacktrace, error messages in the server window, your database.yml file.

If you want help at least give us a fighting chance...

Scott Eisenberg wrote in post #1180887:

How about giving us the output of bundle list? Or at the very least
bundle list pg?

PS If you see pg listed there you’re gonna have to give more information
like the stacktrace, error messages in the server window, your
database.yml file.

If you want help at least give us a fighting chance...

hi scott.

please take a look at this =>
http://8pic.ir/images/cqpc93bssq0dyvqqy33e.png

Why is it apparently so difficult for people to supply the information
asked for? Please just copy/paste your Gemfile here so that we can
see it. We don't want to have to look at screenshots, and even on the
screenshot you have not shown Gemfile.

Also please post Gemfile.lock

Colin

Colin Law wrote in post #1180889:

hi scott.

please take a look at this =>
http://8pic.ir/images/cqpc93bssq0dyvqqy33e.png

Why is it apparently so difficult for people to supply the information
asked for? Please just copy/paste your Gemfile here so that we can
see it. We don't want to have to look at screenshots, and even on the
screenshot you have not shown Gemfile.

Also please post Gemfile.lock

Colin

sorry. i just think u want to see what happened in terminal/browser and
database file.

list of gems :

*** LOCAL GEMS ***

actionmailer (4.2.5)
actionpack (4.2.5)
actionview (4.2.5)
activejob (4.2.5)
activemodel (4.2.5)
activerecord (4.2.5)
activesupport (4.2.5)
adapter (0.7.1)
addressable (2.3.6)
ansi (1.4.3)
arel (6.0.3)
atomic (1.1.16)
bigdecimal (1.2.4)
binding_of_caller (0.7.2)
buftok (0.2.0)
builder (3.2.2)
bundler (1.11.2, 1.7.4)
byebug (8.2.1)
coffee-rails (4.1.1)
coffee-script (2.4.1)
coffee-script-source (1.10.0)
concurrent-ruby (1.0.0)
daemons (1.1.9)
data_objects (0.10.14)
debug_inspector (0.0.2)
diff-lcs (1.2.5)
dm-core (1.2.1)
dm-do-adapter (1.2.0)
dm-migrations (1.2.0)
dm-serializer (1.2.2)
dm-sqlite-adapter (1.2.0)
do_sqlite3 (0.10.14)
em-websocket (0.5.1)
equalizer (0.0.9)
erubis (2.7.0)
eventmachine (1.0.3)
execjs (2.6.0, 2.2.1)
faraday (0.9.0)
ffi (1.9.6)
geoip (1.4.0)
globalid (0.3.6)
http (0.6.1)
http_parser.rb (0.6.0)
httpclient (2.3.3)
i18n (0.7.0)
io-console (0.4.2)
jbuilder (2.4.0)
jquery-rails (4.1.0)
json (1.8.3, 1.8.1)
librex (0.0.68)
libv8 (3.16.14.3)
loofah (2.0.3)
mail (2.6.3)
memoizable (0.4.2)
mime (0.4.2)
mime-types (2.99, 1.25)
mini_exiftool (1.6.0)
mini_portile2 (2.0.0)
minitest (5.8.4, 4.7.5)
mojo_magick (0.5.6)
msfrpc-client (1.0.1)
msgpack (0.5.8)
multi_json (1.11.2, 1.10.1)
multipart-post (1.2.0)
naught (1.0.0)
net-http-persistent (2.9)
nokogiri (1.6.7.2)
oj (2.10.3)
parseconfig (1.0.2)
pg (0.18.4)
psych (2.0.5)
qr4r (0.4.0)
rack (1.6.4, 1.5.2)
rack-protection (1.5.2)
rack-test (0.6.3)
rails (4.2.5)
rails-deprecated_sanitizer (1.0.3)
rails-dom-testing (1.0.7)
rails-html-sanitizer (1.0.2)
railties (4.2.5)
rainbow (2.0.0)
rake (10.5.0, 10.3.2, 10.1.0)
rdoc (4.2.1, 4.1.0)
rdoc-data (4.1.0)
ref (1.0.5)
rexec (1.6.3)
ruby-progressbar (1.6.0)
rubydns (0.7.0)
rubyzip (1.1.6)
sass (3.4.21)
sass-rails (5.0.4)
sdoc (0.4.1)
simple_oauth (0.2.0)
simplecov (0.7.1)
sinatra (1.4.5)
spider (0.4.4)
spring (1.6.2)
sprockets (3.5.2)
sprockets-rails (3.0.0)
sqlite3 (1.3.11, 1.3.9)
term-ansicolor (1.3.0)
terminal-table (1.4.5)
test-unit (2.1.5.0)
therubyracer (0.12.1)
thor (0.19.1)
thread_safe (0.3.5, 0.3.3)
tilt (2.0.2, 1.4.1)
tins (1.1.0)
turbolinks (2.5.3)
twitter (5.11.0)
tzinfo (1.2.2)
uglifier (2.7.2, 2.5.3)
web-console (2.2.1)
yajl-ruby (1.2.0)

What specifically is the OS here. I’m not certain I recognize the icons on the dock.

Also what version of Ruby are you running?

This might be a good place to also look for help: https://bitbucket.org/ged/ruby-pg/issues?status=new&status=open

- the output of `bundle list pg` says "Could not find gem 'pg'."
- the error page says "Add `gem 'pg'` to your Gemfile"

Have you read it? And have you actually done it? (hint: `gem install pg`
is not the same thing)

Colin Law wrote in post #1180889:

hi scott.

please take a look at this =>
http://8pic.ir/images/cqpc93bssq0dyvqqy33e.png

Why is it apparently so difficult for people to supply the information
asked for? Please just copy/paste your Gemfile here so that we can
see it. We don’t want to have to look at screenshots, and even on the
screenshot you have not shown Gemfile.

Also please post Gemfile.lock

Colin

sorry. i just think u want to see what happened in terminal/browser and
database file.

list of gems :

*** LOCAL GEMS ***

That is not the file Gemfile which is a file in the top level of your application. You need to add pg to that and run bundle. The fact you did not realise this shows that you really need to work through the tutorial that I suggested.

Colin

Colin Law wrote in post #1180898:

> asked for? Please just copy/paste your Gemfile here so that we can
list of gems :

*** LOCAL GEMS ***

That is not the file Gemfile which is a file in the top level of your
application. You need to add pg to that and run bundle. The fact you did
not realise this shows that you really need to work through the tutorial
that I suggested.

Colin

arel (6.0.3)
concurrent-ruby (1.0.0)
em-websocket (0.5.1)
httpclient (2.3.3)
mime (0.4.2)
net-http-persistent (2.9)
rails-deprecated_sanitizer (1.0.3)
rubydns (0.7.0)
sprockets-rails (3.0.0)
twitter (5.11.0)
tzinfo (1.2.2)
uglifier (2.7.2, 2.5.3)
web-console (2.2.1)
yajl-ruby (1.2.0)

--
Posted via http://www.ruby-forum.com/.

--
You received this message because you are subscribed to the Google Groups

"Ruby on Rails: Talk" group.

To unsubscribe from this group and stop receiving emails from it, send an

email to rubyonrails-talk+unsubscribe@googlegroups.com.

To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit

https://groups.google.com/d/msgid/rubyonrails-talk/bd4d029afd437577c294ba71bfa51bb1%40ruby-forum.com

.

im sorry.

gem file :

source 'https://rubygems.org'

# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.2.5'
# Use sqlite3 as the database for Active Record
gem 'sqlite3'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 4.1.0'
# See https://github.com/rails/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby

# Use jquery as the JavaScript library
gem 'jquery-rails'
# Turbolinks makes following links in your web application faster. Read
more: https://github.com/rails/turbolinks
gem 'turbolinks'
# Build JSON APIs with ease. Read more:
https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.0'
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', '~> 0.4.0', group: :doc

# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'

# Use Unicorn as the app server
# gem 'unicorn'

# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development

group :development, :test do
  # Call 'byebug' anywhere in the code to stop execution and get a
debugger console
  gem 'byebug'
end

group :development do
  # Access an IRB console on exception pages or by using <%= console %>
in views
  gem 'web-console', '~> 2.0'

  # Spring speeds up development by keeping your application running in
the background. Read more: https://github.com/rails/spring
  gem 'spring'
end

Gemfile . lock

GEM
  remote: https://rubygems.org/
  specs:
    actionmailer (4.2.5)
      actionpack (= 4.2.5)
      actionview (= 4.2.5)
      activejob (= 4.2.5)
      mail (~> 2.5, >= 2.5.4)
      rails-dom-testing (~> 1.0, >= 1.0.5)
    actionpack (4.2.5)
      actionview (= 4.2.5)
      activesupport (= 4.2.5)
      rack (~> 1.6)
      rack-test (~> 0.6.2)
      rails-dom-testing (~> 1.0, >= 1.0.5)
      rails-html-sanitizer (~> 1.0, >= 1.0.2)
    actionview (4.2.5)
      activesupport (= 4.2.5)
      builder (~> 3.1)
      erubis (~> 2.7.0)
      rails-dom-testing (~> 1.0, >= 1.0.5)
      rails-html-sanitizer (~> 1.0, >= 1.0.2)
    activejob (4.2.5)
      activesupport (= 4.2.5)
      globalid (>= 0.3.0)
    activemodel (4.2.5)
      activesupport (= 4.2.5)
      builder (~> 3.1)
    activerecord (4.2.5)
      activemodel (= 4.2.5)
      activesupport (= 4.2.5)
      arel (~> 6.0)
    activesupport (4.2.5)
      i18n (~> 0.7)
      json (~> 1.7, >= 1.7.7)
      minitest (~> 5.1)
      thread_safe (~> 0.3, >= 0.3.4)
      tzinfo (~> 1.1)
    arel (6.0.3)
    binding_of_caller (0.7.2)
      debug_inspector (>= 0.0.1)
    builder (3.2.2)
    byebug (8.2.1)
    coffee-rails (4.1.1)
      coffee-script (>= 2.2.0)
      railties (>= 4.0.0, < 5.1.x)
    coffee-script (2.4.1)
      coffee-script-source
      execjs
    coffee-script-source (1.10.0)
    concurrent-ruby (1.0.0)
    debug_inspector (0.0.2)
    erubis (2.7.0)
    execjs (2.6.0)
    globalid (0.3.6)
      activesupport (>= 4.1.0)
    i18n (0.7.0)
    jbuilder (2.4.0)
      activesupport (>= 3.0.0, < 5.1)
      multi_json (~> 1.2)
    jquery-rails (4.1.0)
      rails-dom-testing (~> 1.0)
      railties (>= 4.2.0)
      thor (>= 0.14, < 2.0)
    json (1.8.3)
    loofah (2.0.3)
      nokogiri (>= 1.5.9)
    mail (2.6.3)
      mime-types (>= 1.16, < 3)
    mime-types (2.99)
    mini_portile2 (2.0.0)
    minitest (5.8.4)
    multi_json (1.11.2)
    nokogiri (1.6.7.2)
      mini_portile2 (~> 2.0.0.rc2)
    rack (1.6.4)
    rack-test (0.6.3)
      rack (>= 1.0)
    rails (4.2.5)
      actionmailer (= 4.2.5)
      actionpack (= 4.2.5)
      actionview (= 4.2.5)
      activejob (= 4.2.5)
      activemodel (= 4.2.5)
      activerecord (= 4.2.5)
      activesupport (= 4.2.5)
      bundler (>= 1.3.0, < 2.0)
      railties (= 4.2.5)
      sprockets-rails
    rails-deprecated_sanitizer (1.0.3)
      activesupport (>= 4.2.0.alpha)
    rails-dom-testing (1.0.7)
      activesupport (>= 4.2.0.beta, < 5.0)
      nokogiri (~> 1.6.0)
      rails-deprecated_sanitizer (>= 1.0.1)
    rails-html-sanitizer (1.0.3)
      loofah (~> 2.0)
    railties (4.2.5)
      actionpack (= 4.2.5)
      activesupport (= 4.2.5)
      rake (>= 0.8.7)
      thor (>= 0.18.1, < 2.0)
    rake (10.5.0)
    rdoc (4.2.1)
      json (~> 1.4)
    sass (3.4.21)
    sass-rails (5.0.4)
      railties (>= 4.0.0, < 5.0)
      sass (~> 3.1)
      sprockets (>= 2.8, < 4.0)
      sprockets-rails (>= 2.0, < 4.0)
      tilt (>= 1.1, < 3)
    sdoc (0.4.1)
      json (~> 1.7, >= 1.7.7)
      rdoc (~> 4.0)
    spring (1.6.2)
    sprockets (3.5.2)
      concurrent-ruby (~> 1.0)
      rack (> 1, < 3)
    sprockets-rails (3.0.0)
      actionpack (>= 4.0)
      activesupport (>= 4.0)
      sprockets (>= 3.0.0)
    sqlite3 (1.3.11)
    thor (0.19.1)
    thread_safe (0.3.5)
    tilt (2.0.2)
    turbolinks (2.5.3)
      coffee-rails
    tzinfo (1.2.2)
      thread_safe (~> 0.1)
    uglifier (2.7.2)
      execjs (>= 0.3.0)
      json (>= 1.8.0)
    web-console (2.2.1)
      activemodel (>= 4.0)
      binding_of_caller (>= 0.7.2)
      railties (>= 4.0)
      sprockets-rails (>= 2.0, < 4.0)

PLATFORMS
  ruby

DEPENDENCIES
  byebug
  coffee-rails (~> 4.1.0)
  jbuilder (~> 2.0)
  jquery-rails
  rails (= 4.2.5)
  sass-rails (~> 5.0)
  sdoc (~> 0.4.0)
  spring
  sqlite3
  turbolinks
  uglifier (>= 1.3.0)
  web-console (~> 2.0)

Colin Law wrote in post #1180898:

> asked for? Please just copy/paste your Gemfile here so that we can
list of gems :

*** LOCAL GEMS ***

That is not the file Gemfile which is a file in the top level of your
application. You need to add pg to that and run bundle. The fact you did
not realise this shows that you really need to work through the tutorial
that I suggested.

Colin

im sorry.

gem file :

source 'https://rubygems.org'

# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.2.5'
# Use sqlite3 as the database for Active Record
gem 'sqlite3'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 4.1.0'
# See https://github.com/rails/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby

# Use jquery as the JavaScript library
gem 'jquery-rails'
# Turbolinks makes following links in your web application faster. Read
more: https://github.com/rails/turbolinks
gem 'turbolinks'
# Build JSON APIs with ease. Read more:
https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.0'
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', '~> 0.4.0', group: :doc

# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'

# Use Unicorn as the app server
# gem 'unicorn'

# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development

group :development, :test do
  # Call 'byebug' anywhere in the code to stop execution and get a
debugger console
  gem 'byebug'
end

group :development do
  # Access an IRB console on exception pages or by using <%= console %>
in views
  gem 'web-console', '~> 2.0'

  # Spring speeds up development by keeping your application running in
the background. Read more: https://github.com/rails/spring
  gem 'spring'
end

I don't see pg in there. As has been pointed out numerous times
already the error message says you need to add pg to Gemfile. Also
you can take out sqlite3, under the line that says

# Use sqlite3 as the database for Active Record

How are you getting on with the tutorial?

Colin

Colin Law wrote in post #1180906:

not realise this shows that you really need to work through the tutorial
that I suggested.

Colin

gem 'rails', '4.2.5'

  # Call 'byebug' anywhere in the code to stop execution and get a
the background. Read more: https://github.com/rails/spring
  gem 'spring'
end

I don't see pg in there. As has been pointed out numerous times
already the error message says you need to add pg to Gemfile. Also
you can take out sqlite3, under the line that says

# Use sqlite3 as the database for Active Record

How are you getting on with the tutorial?

Colin

i just edit source url from https://rubygems.org to http://rubygems.org
and add gem 'pg' in Gemfile after like this=>

source 'http://rubygems.org'

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

and i go to terminal and type 'gem install pg'
then type=> bunlde show pg
and i get the path=> /var/lib/gems/2.1.0/gems/pg-0.18.4

befor that , when i type this. i get this=> Could not find gem 'pg'.

now the error is Gone! :wink:

ty Colin

Colin Law wrote in post #1180906:

not realise this shows that you really need to work through the tutorial
that I suggested.

Colin

gem 'rails', '4.2.5'

  # Call 'byebug' anywhere in the code to stop execution and get a
the background. Read more: https://github.com/rails/spring
  gem 'spring'
end

I don't see pg in there. As has been pointed out numerous times
already the error message says you need to add pg to Gemfile. Also
you can take out sqlite3, under the line that says

# Use sqlite3 as the database for Active Record

How are you getting on with the tutorial?

Colin

i just edit source url from https://rubygems.org to http://rubygems.org
and add gem 'pg' in Gemfile after like this=>

source 'http://rubygems.org'

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

and i go to terminal and type 'gem install pg'

You should have run
bundle install
or just
bundle
there is no need to run gem install pg though it will not do any harm.

then type=> bunlde show pg
and i get the path=> /var/lib/gems/2.1.0/gems/pg-0.18.4

befor that , when i type this. i get this=> Could not find gem 'pg'.

now the error is Gone! :wink:

I am surprised the error is gone if you have not run bundle install or bundle.

Colin