首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Rake db:迁移语法错误

Rake db:迁移语法错误
EN

Stack Overflow用户
提问于 2010-09-22 20:38:33
回答 1查看 932关注 0票数 0

尝试设置webistrano时出现以下错误:

代码语言:javascript
复制
rake db:migrate

(in /var/www/html/webistrano)
rake aborted!
/var/www/html/webistrano/vendor/rails/activesupport/lib/active_support/inflector.rb:273: syntax error, unexpected ':', expecting keyword_then or ',' or ';' or '\n'
        when 1: "#{number}st"
               ^
/var/www/html/webistrano/vendor/rails/activesupport/lib/active_support/inflector.rb:274: syntax error, unexpected keyword_when, expecting keyword_end
        when 2: "#{number}nd"
            ^
/var/www/html/webistrano/vendor/rails/activesupport/lib/active_support/inflector.rb:275: syntax error, unexpected keyword_when, expecting keyword_end
        when 3: "#{number}rd"
            ^
/var/www/html/webistrano/vendor/rails/activesupport/lib/active_support/inflector.rb:280: syntax error, unexpected keyword_end, expecting $end
EN

回答 1

Stack Overflow用户

发布于 2010-09-22 21:35:31

检查ruby语法中的switch-like语句,在when之后没有":“。

代码语言:javascript
复制
case foo
  when "bar"
    # do stuff
  when "bar2"
    # do other stuff
end

顺便说一句,你为什么要这样做呢?如果我没看错您的代码,也许您应该看看ordinalize方法。

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/3769249

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档