Hello to everyone, I have a problem that is giving me a headache, and trying to do a project in Ruby on Rails and I need to connect with a Data Base that is en Postgres, the truth is that I didn't think that it was so hard to connect a DB with postgres because I was working with Msyql and everything was easy. This are the thinks that I have install in my computer.
1. Debian GNU/Linux, kernel 2.4.27-2-686. 2. Ruby 1.8.2 3. Postgresql 7.4.7-6 sarge1 4. Gems: actionmailer-1.2.5, actionpack-1.12.5, actionwebservice-1.1.6, activerecord-1.14.4, activesupport-1.3.1, postgres-pr-0.2.1, rails-1.1.6, rake-0.7.1 5. ruby-postgres-0.7.1.tar.tar
The error is that after I install everything that I need, I can't connect with my DB, in my project in the folder /app/models I made a archive with the same name off my table, remembering that my real table the name is in plural bout in my project in singular, the thinks that I wrote look something like this
ActiveRecord::Base.establish_connection( :adapter => "postgresql", :host => "localhost", :port => "5432", :database => "mundo", :username => "usuario", :password => "123456"
)
class Usuario < ActiveRecord::Base
end
When I try to save something in my DB the error that appears is like this
TypeError in PruebaController#guardar can't convert String into Integer
RAILS_ROOT: script/../config/.. Application Trace | Framework Trace | Full Trace
/usr/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/connection_adapters/postgresql_adapter.rb:24:in `initialize' /usr/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/connection_adapters/postgresql_adapter.rb:24:in `connect' /usr/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/connection_adapters/postgresql_adapter.rb:24:in `postgresql_connection' /usr/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/connection_adapters/abstract/connection_specification.rb:251:in `send' /usr/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/connection_adapters/abstract/connection_specification.rb:251:in `connection_without_query_cache=' /usr/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/query_cache.rb:54:in `connection=' /usr/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/connection_adapters/abstract/connection_specification.rb:220:in `retrieve_connection' /usr/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/connection_adapters/abstract/connection_specification.rb:78:in `connection' /usr/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/base.rb:696:in `columns' /usr/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/base.rb:1969:in `attributes_from_column_definition' /usr/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/base.rb:1351:in `initialize_without_callbacks' /usr/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/callbacks.rb:236:in `initialize' app/controllers/prueba_controller.rb:9:in `new' app/controllers/prueba_controller.rb:9:in `guardar' -e:4:in `load' -e:4 /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:172:in `start_thread' /usr/lib/ruby/1.8/webrick/server.rb:161:in `start' /usr/lib/ruby/1.8/webrick/server.rb:161:in `start_thread' /usr/lib/ruby/1.8/webrick/server.rb:95:in `start'
Request Parameters: {"commit"=>"Guardar", "usuario"=>{"apellido"=>"GGGGGG", "cedula"=>"888888", "nombre"=>"MMMMM", "telefono"=>"5555555"}} Show session dump flash: !ruby/hash:ActionController::Flash::FlashHash {}
Response Headers: {"cookie"=>, "Cache-Control"=>"no-cache"}
Pleas if someone know how to help me I'll be grateful.
From Venezuela. El_gocho says thank you.
P.S: sorry if I wrote something wrong, my English writhing is not so good.