Rails - 应用程序无法在 Heroku 中运行

发布于 2024-11-10 17:09:58 字数 930 浏览 0 评论 0原文

我的应用程序在本地主机中正常工作,但是当我推送到 heroku 时,我收到此错误:

2011-05-31T00:31:58+00:00 app[web.1]: /app/.bundle/gems/ruby/1.8/gems/
activesupport-3.0.5/lib/active_support/
dependencies.rb:239:in `require': /app/app/controllers/avaliacaos_controller.rb:40:
syntax error, unexpected kEND, expecting $end (SyntaxError)

知道吗?

编辑

class AvaliacaosController < ApplicationController

def new
  @profile = Profile.find(params[:profile])
  @avaliado = Profile.find(params[:avaliado])
  @projeto = Projeto.find(params[:projeto_id])
  @avaliacao = Avaliacao.new
end


def create
  @profile = Profile.find(current_profile)
  @avaliacao  = Avaliacao.new(params[:avaliacao])
  @projeto = Projeto.find(params[:avaliacao][:projeto_id])
if @avaliacao.save
  flash[:success] = "Avaliação Criada com Sucesso."
  redirect_to @projeto
else
  redirect_to (:back)
end
end


end

My app is working correctly in localhost, but when I push to heroku I'm getting this error:

2011-05-31T00:31:58+00:00 app[web.1]: /app/.bundle/gems/ruby/1.8/gems/
activesupport-3.0.5/lib/active_support/
dependencies.rb:239:in `require': /app/app/controllers/avaliacaos_controller.rb:40:
syntax error, unexpected kEND, expecting $end (SyntaxError)

Any idea?

EDIT

class AvaliacaosController < ApplicationController

def new
  @profile = Profile.find(params[:profile])
  @avaliado = Profile.find(params[:avaliado])
  @projeto = Projeto.find(params[:projeto_id])
  @avaliacao = Avaliacao.new
end


def create
  @profile = Profile.find(current_profile)
  @avaliacao  = Avaliacao.new(params[:avaliacao])
  @projeto = Projeto.find(params[:avaliacao][:projeto_id])
if @avaliacao.save
  flash[:success] = "Avaliação Criada com Sucesso."
  redirect_to @projeto
else
  redirect_to (:back)
end
end


end

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

十秒萌定你 2024-11-17 17:09:58

该错误

syntax error, unexpected kEND, expecting $end (SyntaxError)

表明您的文件 avaliacaos_controller.rb 的“end”数量不匹配(太多或太少)。

也许这不会出现在本地,因为加载服务器时控制器没有加载,而在生产中它是加载的。尝试以使用此控制器的方式在本地运行您的应用程序,您应该会看到相同的错误。

The error

syntax error, unexpected kEND, expecting $end (SyntaxError)

suggests that your file avaliacaos_controller.rb has a mismatched number of 'end's (either too many or too few).

Maybe this isn't appearing locally because the controller is not loaded when the server is loaded, whereas in production it is. Try running your app locally in such a way that this controller is used and you should see the same error.

迷鸟归林 2024-11-17 17:09:58

确保 heroku 拥有您的最新代码。尝试“git status”以确保它是干净的(没有列出文件),然后你“git push heroku master”

我的假设是你没有推送到heroku,或者如果你这样做了,那么你还没有提交本地代码。

Make sure heroku has your latest code. Try a "git status" to make sure that it is clean (no files are listed), and then you "git push heroku master"

My hypothesis is that you did not push to heroku, or if you did, then you have not committed code locally.

可可 2024-11-17 17:09:58

尝试
heroku 运行 rake db:migrate

try
heroku run rake db:migrate

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文