Forum: Ruby on Rails NoMethodError: undefined method `fformat' - rake aborted!

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
24d37788e3e7896a30a6cf02c3a7b088?d=identicon&s=25 Eric Roscher (roschereric)
on 2008-12-07 01:43
Hello,

I have installed postgresql 8.3 in linux Mint 6 r1 (ubuntu 8.10) and the
ruby from ubuntu repositories, then "gem install rails -y"

I've installed "gem -install postgres-pr -y" and configured the
database.yml as follows:

database.yml
#########################################
common: &common
  adapter: postgresql
  timeout: 5000
  host: localhost
  username: eric
  password: ************
  enconding: utf8

development:
  database: panthro_devel
  <<: *common

test:
  database: panthro_test
  <<: *common

production:
  database: panthro
  <<: *common

#########################################

Those databases are created in the server, and the auth in my
pg_hba.conf for local connections is setted on "trust" value.

I've issued some scaffolding for 2 entities, and tried to migrate them
with "rake db:migrate --trace" and i've got the following error trace:



error trace:
#########################################
(in /home/eric/Proyectos/panthro)
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute db:migrate
rake aborted!
NoMethodError: undefined method `fformat' for #<PGresult:0xb7afce74>:
SHOW client_min_messages
/home/eric/Proyectos/panthro/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb:147:in
`log'
/home/eric/Proyectos/panthro/vendor/rails/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb:444:in
`query'
/home/eric/Proyectos/panthro/vendor/rails/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb:605:in
`client_min_messages'
/home/eric/Proyectos/panthro/vendor/rails/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb:245:in
`supports_standard_conforming_strings?'
/home/eric/Proyectos/panthro/vendor/rails/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb:836:in
`connect'
/home/eric/Proyectos/panthro/vendor/rails/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb:185:in
`initialize'
/home/eric/Proyectos/panthro/vendor/rails/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb:37:in
`new'
/home/eric/Proyectos/panthro/vendor/rails/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb:37:in
`postgresql_connection'
/home/eric/Proyectos/panthro/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/connection_specification.rb:292:in
`send'
/home/eric/Proyectos/panthro/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/connection_specification.rb:292:in
`connection='
/home/eric/Proyectos/panthro/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/connection_specification.rb:260:in
`retrieve_connection'
/home/eric/Proyectos/panthro/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/connection_specification.rb:78:in
`connection'
/home/eric/Proyectos/panthro/vendor/rails/activerecord/lib/active_record/migration.rb:386:in
`initialize'
/home/eric/Proyectos/panthro/vendor/rails/activerecord/lib/active_record/migration.rb:357:in
`new'
/home/eric/Proyectos/panthro/vendor/rails/activerecord/lib/active_record/migration.rb:357:in
`up'
/home/eric/Proyectos/panthro/vendor/rails/activerecord/lib/active_record/migration.rb:340:in
`migrate'
/home/eric/Proyectos/panthro/vendor/rails/railties/lib/tasks/databases.rake:99
/usr/lib/ruby/1.8/rake.rb:546:in `call'
/usr/lib/ruby/1.8/rake.rb:546:in `execute'
/usr/lib/ruby/1.8/rake.rb:541:in `each'
/usr/lib/ruby/1.8/rake.rb:541:in `execute'
/usr/lib/ruby/1.8/rake.rb:508:in `invoke_with_call_chain'
/usr/lib/ruby/1.8/rake.rb:501:in `synchronize'
/usr/lib/ruby/1.8/rake.rb:501:in `invoke_with_call_chain'
/usr/lib/ruby/1.8/rake.rb:494:in `invoke'
/usr/lib/ruby/1.8/rake.rb:1931:in `invoke_task'
/usr/lib/ruby/1.8/rake.rb:1909:in `top_level'
/usr/lib/ruby/1.8/rake.rb:1909:in `each'
/usr/lib/ruby/1.8/rake.rb:1909:in `top_level'
/usr/lib/ruby/1.8/rake.rb:1948:in `standard_exception_handling'
/usr/lib/ruby/1.8/rake.rb:1903:in `top_level'
/usr/lib/ruby/1.8/rake.rb:1881:in `run'
/usr/lib/ruby/1.8/rake.rb:1948:in `standard_exception_handling'
/usr/lib/ruby/1.8/rake.rb:1878:in `run'
/usr/bin/rake:28
#####################################

I've looked into "abstract_adapter.rb" and "postgresql_adapter.rb" in
those lines just for curiosity to see the problem with a better aproach,
but I've got nothing since I'm not just mastering rails...

It would be great if some of you could helpme with this issue. I beg you
sorry about my english! XD

Thank you in advance!
24d37788e3e7896a30a6cf02c3a7b088?d=identicon&s=25 Eric Roscher (roschereric)
on 2008-12-07 01:55
Sorry, I've forgotten to say that I've tried to issue manually those
queries that postgresql_adapter.rb does, and jere are the results, just
in case that could help:

postgresql_adapter.rb (line 251):

      query('SHOW standard_conforming_strings')[0][0] => 'off'

postgresql_adapter.rb (line 605):

      query('SHOW client_min_messages')[0][0] => 'notice'
9c93e8b4826699f1de1180b79a546d53?d=identicon&s=25 Foreero Ivan (ivmafo)
on 2009-11-16 23:27
Did you solve  this error ??
but I'm using postgres psql (8.4.1)

 NoMethodError in UsuariosController#index

undefined method `fformat' for #<PGresult:0x7f7f37b4daa8>


vendor/rails/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb:472:in
`result_as_array'
vendor/rails/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb:470:in
`each'
vendor/rails/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb:470:in
`result_as_array'
vendor/rails/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb:1001:in
`select_raw'
vendor/rails/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb:987:in
`select'
vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:7:in
`select_all_without_query_cache'
vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb:60:in
`select_all'
vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb:81:in
`cache_sql'
vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb:60:in
`select_all'
vendor/rails/activerecord/lib/active_record/base.rb:635:in `find_by_sql'
vendor/rails/activerecord/lib/active_record/base.rb:1490:in `find_every'
vendor/rails/activerecord/lib/active_record/base.rb:589:in `find'
app/controllers/usuarios_controller.rb:5:in `index'
vendor/rails/actionpack/lib/action_controller/base.rb:1256:in `send'
vendor/rails/actionpack/lib/action_controller/base.rb:1256:in
`perform_action_without_filters'
vendor/rails/actionpack/lib/action_controller/filters.rb:617:in
`call_filters'
vendor/rails/actionpack/lib/action_controller/filters.rb:610:in
`perform_action_without_benchmark'
vendor/rails/actionpack/lib/action_controller/benchmarking.rb:68:in
`perform_action_without_rescue'
/usr/lib/ruby/1.8/benchmark.rb:293:in `measure'
vendor/rails/actionpack/lib/action_controller/benchmarking.rb:68:in
`perform_action_without_rescue'
vendor/rails/actionpack/lib/action_controller/rescue.rb:136:in
`perform_action_without_caching'
vendor/rails/actionpack/lib/action_controller/caching/sql_cache.rb:13:in
`perform_action'
vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb:34:in
`cache'
vendor/rails/activerecord/lib/active_record/query_cache.rb:8:in `cache'
vendor/rails/actionpack/lib/action_controller/caching/sql_cache.rb:12:in
`perform_action'
vendor/rails/actionpack/lib/action_controller/base.rb:524:in `send'
vendor/rails/actionpack/lib/action_controller/base.rb:524:in
`process_without_filters'
vendor/rails/actionpack/lib/action_controller/filters.rb:606:in
`process_without_session_management_support'
vendor/rails/actionpack/lib/action_controller/session_management.rb:134:in
`process'
vendor/rails/actionpack/lib/action_controller/base.rb:392:in `process'
vendor/rails/actionpack/lib/action_controller/dispatcher.rb:184:in
`handle_request'
vendor/rails/actionpack/lib/action_controller/dispatcher.rb:112:in
`dispatch_unlocked'
vendor/rails/actionpack/lib/action_controller/dispatcher.rb:125:in
`dispatch'
vendor/rails/actionpack/lib/action_controller/dispatcher.rb:124:in
`synchronize'
vendor/rails/actionpack/lib/action_controller/dispatcher.rb:124:in
`dispatch'
vendor/rails/actionpack/lib/action_controller/dispatcher.rb:134:in
`dispatch_cgi'
vendor/rails/actionpack/lib/action_controller/dispatcher.rb:41:in
`dispatch'
vendor/rails/railties/lib/webrick_server.rb:103:in `handle_dispatch'
vendor/rails/railties/lib/webrick_server.rb:74:in `service'
/usr/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'
/usr/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'
/usr/lib/ruby/1.8/webrick/server.rb:173:in `start_thread'
/usr/lib/ruby/1.8/webrick/server.rb:162:in `start'
/usr/lib/ruby/1.8/webrick/server.rb:162:in `start_thread'
/usr/lib/ruby/1.8/webrick/server.rb:95:in `start'
/usr/lib/ruby/1.8/webrick/server.rb:92:in `each'
/usr/lib/ruby/1.8/webrick/server.rb:92:in `start'
/usr/lib/ruby/1.8/webrick/server.rb:23:in `start'
/usr/lib/ruby/1.8/webrick/server.rb:82:in `start'
vendor/rails/railties/lib/webrick_server.rb:60:in `dispatch'
vendor/rails/railties/lib/commands/servers/webrick.rb:66
/usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in
`gem_original_require'
/usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in `require'
vendor/rails/activesupport/lib/active_support/dependencies.rb:153:in
`require'
vendor/rails/activesupport/lib/active_support/dependencies.rb:521:in
`new_constants_in'
vendor/rails/activesupport/lib/active_support/dependencies.rb:153:in
`require'
vendor/rails/railties/lib/commands/server.rb:49
/usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in
`gem_original_require'
/usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in `require'
script/server:3





PLEASE HELPPP !!!
Dd2d775dea75b381edb1bbf0600a0907?d=identicon&s=25 Marnen Laibow-Koser (marnen)
on 2009-11-17 03:32
Eric Roscher wrote:
> Hello,
>
> I have installed postgresql 8.3 in linux Mint 6 r1 (ubuntu 8.10) and the
> ruby from ubuntu repositories, then "gem install rails -y"
>
> I've installed "gem -install postgres-pr -y"
[...]

Is there any particular reason that you're using postgres-pr instead of
postgres or pg?

Best,
--
Marnen Laibow-Koser
http://www.marnen.org
marnen@marnen.org
This topic is locked and can not be replied to.