PDA

View Full Version : Problems getting started: RoR localhost issues


harpoon45
December 13th, 2007, 11:58 AM
Noob here:


I just setup ruby and was trying to run the following commands:

>> class Story < ActiveRecord::Base; end
=> nil
>> story = Story.new

SocketError: getaddrinfo: Name or service not known
from
/usr/local/lib/ruby/gems/1.8/gems/activerecord-2.0.1/lib/active_record/vendor/mysql.rb:111:in
`initialize'
from
/usr/local/lib/ruby/gems/1.8/gems/activerecord-2.0.1/lib/active_record/vendor/mysql.rb:111:in
`new'
from
/usr/local/lib/ruby/gems/1.8/gems/activerecord-2.0.1/lib/active_record/vendor/mysql.rb:111:in
`real_connect'
from
/usr/local/lib/ruby/gems/1.8/gems/activerecord-2.0.1/lib/active_record/connection_adapters/mysql_adapter.rb:471:in
`connect'
from
/usr/local/lib/ruby/gems/1.8/gems/activerecord-2.0.1/lib/active_record/connection_adapters/mysql_adapter.rb:165:in
`initialize'
from
/usr/local/lib/ruby/gems/1.8/gems/activerecord-2.0.1/lib/active_record/connection_adapters/mysql_adapter.rb:88:in
`new'
from
/usr/local/lib/ruby/gems/1.8/gems/activerecord-2.0.1/lib/active_record/connection_adapters/mysql_adapter.rb:88:in
`mysql_connection'
from
/usr/local/lib/ruby/gems/1.8/gems/activerecord-2.0.1/lib/active_record/connection_adapters/abstract/connection_specification.rb:291:in
`send'
from
/usr/local/lib/ruby/gems/1.8/gems/activerecord-2.0.1/lib/active_record/connection_adapters/abstract/connection_specification.rb:291:in
`connection='
from
/usr/local/lib/ruby/gems/1.8/gems/activerecord-2.0.1/lib/active_record/connection_adapters/abstract/connection_specification.rb:259:in
`retrieve_connection'
from
/usr/local/lib/ruby/gems/1.8/gems/activerecord-2.0.1/lib/active_record/connection_adapters/abstract/connection_specification.rb:78:in
`connection'
from
/usr/local/lib/ruby/gems/1.8/gems/activerecord-2.0.1/lib/active_record/base.rb:1007:in
`columns'
from
/usr/local/lib/ruby/gems/1.8/gems/activerecord-2.0.1/lib/active_record/base.rb:2290:in
`attributes_from_column_definition_without_lock'
from
/usr/local/lib/ruby/gems/1.8/gems/activerecord-2.0.1/lib/active_record/locking/optimistic.rb:55:in
`attributes_from_column_definition'
from
/usr/local/lib/ruby/gems/1.8/gems/activerecord-2.0.1/lib/active_record/base.rb:1849:in
`initialize'
from (irb):2:in `new'
from (irb):2>>

From what I read it said that there might be problem with /etc/hosts
I checked it and what I have in there is:

# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 localhost localhost


This is the ruby version i'm using:

ruby 1.8.6 (2007-03-13 patchlevel 0) [i686-linux]

rob
December 13th, 2007, 06:13 PM
What hostname or address are you using in database.yml for your database server?