【问题标题】:I cannot execute rake db:migrate - Unexpected ':'我无法执行 rake db:migrate - Unexpected ':'
【发布时间】:2020-07-26 08:09:37
【问题描述】:

我正在使用在线网站进行应用设计。我正在使用 ubuntu 进行 ruby​​ on rails 安装。我试过运行这些命令:

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

一切正常。接下来,我运行rake db:migrate。但是,我收到此错误消息:

/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)

有人可以帮我解决这些问题吗?

【问题讨论】:

    标签: ruby-on-rails ruby ubuntu web-applications rake


    【解决方案1】:

    您的文件db/migrate/20200413005922_create_pioneers.rb似乎有语法错误

    t.string : first_name
    

    应该是

    t.string :first_name
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-10-31
      • 1970-01-01
      • 2017-07-30
      • 1970-01-01
      • 2015-12-03
      • 2013-05-11
      • 2012-09-06
      相关资源
      最近更新 更多