Rails - 应用程序无法在 Heroku 中运行
我的应用程序在本地主机中正常工作,但是当我推送到 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
该错误
表明您的文件 avaliacaos_controller.rb 的“end”数量不匹配(太多或太少)。
也许这不会出现在本地,因为加载服务器时控制器没有加载,而在生产中它是加载的。尝试以使用此控制器的方式在本地运行您的应用程序,您应该会看到相同的错误。
The error
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.
确保 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.
尝试
heroku 运行 rake db:migrate
try
heroku run rake db:migrate