Forum: Rails-ES Presentación y primera duda

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.
83a381349bddc3b0bc8fd784a26c113e?d=identicon&s=25 Sebas Mgc (sebasstyle)
on 2009-03-06 19:28
(Received via mailing list)
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:

<code>
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

</code>

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

<erro>
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:in
`gem_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:in
`cloaker_'

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:in
`cloaker_'

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:in
`new'
  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: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
/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:in
`require'
  from script/server:3

</error>

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


Un saludo!
9e94436f8f108df3894576778ad26c14?d=identicon&s=25 Diego Fernandez (Guest)
on 2009-03-06 19:42
(Received via mailing list)
On Fri, Mar 6, 2009 at 7:30 PM, Sebas <sebasmgc@gmail.com> wrote:

>
>
> <code>
> 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 :P



--
Diego Fernández Fernández

http://simplelogica.net
83a381349bddc3b0bc8fd784a26c113e?d=identicon&s=25 Sebas Mgc (sebasstyle)
on 2009-03-06 20:03
(Received via mailing list)
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 :D
7841fbf022cfe78bff34942b50c483e1?d=identicon&s=25 Ceritium (Guest)
on 2009-03-07 00:38
(Received via mailing list)
Saludos Sebas, me alegro que siguieras el consejo :P
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.
This topic is locked and can not be replied to.