Presentación y primera duda


#1

Hola!

Soy Sebas y llego aquí por recomendación de Jose Galisteo, de Flowers.

Estoy comenzando con esto de RoR y me he encontrado con un problema
insalvable por el momento, os cuento:

Estoy trabajando con Ubuntu 8.10, ruby 1.8.7, mysql 14.12 y rails 2.2.2.
Después de tenerlo todo instalado y hacer algunas pruebas sencillas de
“H.W.!” me dispongo a configurar database.yml y aquí empiezan los
problemas. Os adjunto la info de configuración de prueba que estoy
usando:

development: adapter: mysql database: dubabu_dev username: root password: 1234 host: localhost

Warning: The database defined as “test” will be erased and

re-generated from your development database when you run “rake”.

Do not set this db to the same as development or production.

test:
adapter: mysql
database: dubabu_test
username: root
password: 1234
host: localhost

production:
adapter: mysql
database: dubabu_pro
username: root
password: 1234
host: localhost

Pues bien, después de guardar el archivo, e intentar arrancar el
servidor con Mongrel y WEBrick me da un sintax error:

Exiting /usr/lib/ruby/1.8/yaml.rb:133:in `load': syntax error on line 3, col 10: `username: root' (ArgumentError) from /usr/lib/ruby/1.8/yaml.rb:133:in `load'

from
./script/…/config/…/vendor/rails/railties/lib/initializer.rb:701:in
`database_configuration’

from
./script/…/config/…/vendor/rails/railties/lib/initializer.rb:331:in
`initialize_database’

from
./script/…/config/…/vendor/rails/railties/lib/initializer.rb:120:in
`process’

from
./script/…/config/…/vendor/rails/railties/lib/initializer.rb:93:in
`send’

from
./script/…/config/…/vendor/rails/railties/lib/initializer.rb:93:in
run' from /home/sebasstyle/Webs/Factoria2.0/config/environment.rb:13 from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:ingem_original_require’
from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in
`require’

from
/home/sebasstyle/Webs/Factoria2.0/vendor/rails/activesupport/lib/active_support/dependencies.rb:509:in
`require’

from
/home/sebasstyle/Webs/Factoria2.0/vendor/rails/activesupport/lib/active_support/dependencies.rb:354:in
`new_constants_in’

from
/home/sebasstyle/Webs/Factoria2.0/vendor/rails/activesupport/lib/active_support/dependencies.rb:509:in
`require’

from
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/…/lib/mongrel/rails.rb:147:in
rails' from /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/mongrel_rails:113:incloaker_’

from
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel/configurator.rb:149:in
`call’

from
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel/configurator.rb:149:in
listener' from /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/mongrel_rails:99:incloaker_’

from
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel/configurator.rb:50:in
`call’

from
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel/configurator.rb:50:in
initialize' from /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/mongrel_rails:84:innew’
from /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/mongrel_rails:84:in
`run’

from
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel/command.rb:212:in
`run’
from /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/mongrel_rails:281

from
/home/sebasstyle/Webs/Factoria2.0/vendor/rails/activesupport/lib/active_support/dependencies.rb:502:in
`load’

from
/home/sebasstyle/Webs/Factoria2.0/vendor/rails/activesupport/lib/active_support/dependencies.rb:502:in
`load’

from
/home/sebasstyle/Webs/Factoria2.0/vendor/rails/activesupport/lib/active_support/dependencies.rb:354:in
`new_constants_in’

from
/home/sebasstyle/Webs/Factoria2.0/vendor/rails/activesupport/lib/active_support/dependencies.rb:502:in
`load’

from
/home/sebasstyle/Webs/Factoria2.0/vendor/rails/railties/lib/commands/servers/mongrel.rb:64
from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in
gem_original_require' from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:inrequire’

from
/home/sebasstyle/Webs/Factoria2.0/vendor/rails/activesupport/lib/active_support/dependencies.rb:509:in
`require’

from
/home/sebasstyle/Webs/Factoria2.0/vendor/rails/activesupport/lib/active_support/dependencies.rb:354:in
`new_constants_in’

from
/home/sebasstyle/Webs/Factoria2.0/vendor/rails/activesupport/lib/active_support/dependencies.rb:509:in
`require’

from
/home/sebasstyle/Webs/Factoria2.0/vendor/rails/railties/lib/commands/server.rb:39
from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in
gem_original_require' from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:inrequire’
from script/server:3

Si alguien tiene una idea de por donde puede venir el problema le invito
a una tapita de jamón.

Un saludo!


#2

On Fri, Mar 6, 2009 at 7:30 PM, Sebas removed_email_address@domain.invalid wrote:

development: adapter: mysql database: dubabu_dev username: root password: 1234 host: localhost

El problema es la indentación. De la wikipedia:

“The specific number of spaces in the indentation is unimportant as long
as
parallel elements have the same left justification and the
hierarchically
nested elements are indented further.”

Así que username, password y host al mismo nivel de indentación que
database
y adapter.

El jamón me gusta con cerveza :stuck_out_tongue:


Diego Fernández Fernández

http://simplelogica.net


#3

Gracias Diego!

Había tenido en cuenta la identación pero según se ve sin mucho exito :S

Va todo perfecto ahora!!
PD: la tapita llevaba la cerveza de acompañamiento desde el principio :smiley:


#4

Saludos Sebas, me alegro que siguieras el consejo :stuck_out_tongue:
Por lo que veo ya te ha sido util.

Otro consejillo, trata de pasarte a la ruby 1.8.6, la 1.8.7 da algunos
problemas, pocos, pero los da y te puedes volver loco hasta que te des
cuenta que es culpa de la versión.