0

Estoy siguiendo un curso en línea de desarrollo web para generar una aplicación, he estado utilizando ubuntu para la instalación de ruby on rails, y he corrido los siguientes comandos:

rails new hello_WWW
cd hello_www
rails generate scaffold pioneer first_name:string last_name:string

pero al correr rake db:migrate recibo esto:

/root/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/actionpack-6.0.2.2/lib/action_dispatch/middleware/stack.rb:37: warning: Using the last argument as keyword parameters is deprecated; maybe ** should be added to the call
/root/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/actionpack-6.0.2.2/lib/action_dispatch/middleware/static.rb:110: warning: The called method `initialize' is defined here
rake aborted!
SyntaxError: /root/hello_WWW/db/migrate/20200413005922_create_pioneers.rb:4: syntax error, unexpected ':'
      t.string : first_name
               ^

Tasks: TOP => db:migrate
(See full trace by running task with --trace)

1 respuesta 1

0

La solución está en el error. Te da toda la información que necesitas:

SyntaxError: /root/hello_WWW/db/migrate/20200413005922_create_pioneers.rb:4: syntax error, unexpected ':'
      t.string : first_name

SyntaxError dice que es un error de sintaxis, o en otras palabras, escribiste algo mal que no puede ser interpretado por ruby.
/root/hello_WWW/db/migrate/20200413005922_create_pioneers.rb:4 te dice el archivo y la línea (4) donde se originó el error.
Finalmente en:

syntax error, unexpected ':'
      t.string : first_name

te explica que no esperaba encontrar un : solo, que de hecho es algo que no se usa en ruby. Lo que espera un t.string es un symbol como parámetro. Para que funcione, debería ser como:

      t.string :first_name

Tu Respuesta

By clicking “Publica tu respuesta”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

¿No es la respuesta que buscas? Examina otras preguntas con la etiqueta o formula tu propia pregunta.