Tag: heroku

Rails.application.routes.url_helpers崩溃Heroku应用程序

我正在为Collection + Json构建一个Serializer ,我正在编写一个API作为示例。 在Heroku上部署的应用程序上使用Rails.application.routes.url_helpers时遇到问题。 我在一个序列化器中使用它: Rails.application.routes.url_helpers.bills_url 在开发中,一切正常。 但是,在Heroku上,这会引发错误: undefined method ‘bills_url’ for # (NoMethodError) 。 如果我转储Rails.application.routes.url_helpers.methods ,则不会列出_url或_path方法。 但是,如果我在控制台中运行相同的代码,它们就是: heroku run rails c –app myapp > Rails.application.routes.url_helpers.methods > # => :bills_url is present 这很奇怪。 这有什么线索吗? Heroku是否使url_helpers不可用? 我绝对迷路了。 我google了很多但没有发现任何东西。 这是完整跟踪的错误报告 。 谢谢。

如何合并两个具有Heroku上相同模式的数据库?

我创建了两个在heroku上基本相同的应用程序。 他们开始时不同,因为我正在测试上传到heroku并且在进行调整时遇到了一些挑战。 但现在事情似乎有效,但两者都有我希望巩固的数据。 由于它们运行相同的git存储库,因此代码与迁移相同。 似乎我需要在本地将其归结并合并,但不清楚如何做到这一点。 在Google上进行了一些搜索并没有明确的说明 我想逐步提供一些帮助,我没有明确的流程。 1)我在heroku上有两个应用程序,我有数据库。 他们有相同的模式; 2)我不需要知道数据的来源:我只需要将它们全部放在一个数据库中 3)我希望能够使用特定的sql命令,而不是手动打开(不确定我将如何做),然后重复,因为有大约10个不同的相互关联的表。 谢谢!

Heroku错误:ActionView :: Template :: Error(未定义的方法`validation码’用于#)

一切都在我当地的环境中正常运作。 当我尝试部署到heroku并最初查看我的网站时,它给了我以下错误:“我们很抱歉,但出了点问题。如果您是应用程序所有者,请查看日志以获取更多信息。” 当我检查我的“heroku日志”时,我发现此错误消息: ActionView :: Template :: Error(未定义的方法`captcha’用于-Message:0x007fc9df016930-) HTML表单视图/ pages / index.html.erb “message_name_input message_input_default”, :placeholder => ” First Name” %> “message_name_input message_input_default”, :placeholder => ” Last Name” %> true, :class => “message_email_input message_input_default”, :placeholder => ” * Email” %> true, :class => “message_user-message_input”, :placeholder => ” * Write a message” %> true, :class => “message_input_default”, […]

错误推送到heroku; heroku正在尝试安装与sqlite3相关的东西

我正在尝试将应用程序推送到heroku并且收到以下错误消息。 我已经看到了关于这个主题的其他一些post,我没有看到解决它。 我没有在应用程序中的任何地方引用sqlite3,也没有在我自己的系统中将它作为gem。 想法? Installing dependencies using Bundler version 1.2.0.pre Running: bundle install –without development:test –path vendor/bundle –binstubs bin/ –deployment Fetching gem metadata from https://rubygems.org/……. Installing rake (0.9.2.2) Installing i18n (0.6.0) Installing multi_json (1.3.6) Installing activesupport (3.2.3) Installing builder (3.0.0) Installing activemodel (3.2.3) Installing erubis (2.7.0) Installing journey (1.0.4) Installing rack (1.4.1) Installing rack-cache (1.2) […]

Ruby Rack Heroku:提供静态文件

我遵循Heroku指南使用Ruby Rack( https://devcenter.heroku.com/articles/static-sites-ruby )部署静态文件,但除了index.html之外,我无法访问\public任何HTML文件。 也就是说, localhost:9292/test.html仍然映射到index.html 。 (我的所有样式和js文件都正确提供)。 下面是我的config.ru文件。 我知道什么是错的,但不确定有效的解决方案? use Rack::Static, :urls => [“/images”, “/js”, “/css”], :root => “public” run lambda { |env| [ 200, { ‘Content-Type’ => ‘text/html’, ‘Cache-Control’ => ‘public, max-age=86400’ }, File.open(‘public/index.html’, File::RDONLY) ] }

Nokogiri在heroku上产生不同的结果?

我有一个非常奇怪的问题,我很感激帮助追踪它。 我正在使用nokogiri gem解析一些html,我正在解析一个有奇怪字符的文件。 不完全确定这个角色是什么,在vim中它显示为^ Q. 在我自己的计算机上,一切正常,但是在heroku上它插入当它击中角色时,选择器只返回奇怪角色之前的元素。 为了说明: Nokogiri::HTML( open(“http://thoms.net.nz/e2.html”)).css(“body div”).count在heroku上Nokogiri::HTML( open(“http://thoms.net.nz/e2.html”)).css(“body div”).count为1,在计算机上Nokogiri::HTML( open(“http://thoms.net.nz/e2.html”)).css(“body div”).count为2。 – 可以从http://thoms.net.nz/e2.html下载包含此字符的文件。 我的计算机和heroku都使用ruby 1.9.3运行nokogiri 1.5.5。

Heroku Ruby版本不升级?

我正在努力改变Heroku上的Ruby版本。 我使用带有rails 4的Ruby 2.0.0。 我的Gemfile有: source ‘https://rubygems.org’ ruby ‘2.0.0’ … Heroku中的路径指向: $ heroku config -s | grep PATH PATH=bin:vendor/bundle/ruby/1.9.1/bin:/usr/local/bin:/usr/bin:/bin 当我推动我的应用程序时,我可以看到: Fetching repository, done. Counting objects: 7, done. Delta compression using up to 4 threads. Compressing objects: 100% (4/4), done. Writing objects: 100% (4/4), 431 bytes | 0 bytes/s, done. Total 4 (delta 3), reused 0 […]

Heroku – 如何将数据从数据库提取到本地数据库?

我试图在Heroku上获取数据库,并从那里获取数据以保存到我的本地数据库中。 当我尝试 heroku db:pull 并确认应用程序的名称,我得到: ! db:push and db:pull have been removed and replaced with pg:push and pg:pull. ! For more information, please see: ! devcenter.heroku.com/articles/heroku-postgresql#pg-push-and-pg-pull 好的,所以: pg:pull 收益: -bash: pg:pull: command not found heroku pg:pull 回报 ! `pg:pull` is not a heroku command. ! Perhaps you meant `db:pull` or `pg:psql`. ! See `heroku help` […]

Heroku推送错误:rake资产上的“NameError:未初始化的常量Uglifier :: VERSION”:预编译

我在尝试推向生产时收到以下错误。 这是推送的结果: $ git push production master Counting objects: 124, done. Delta compression using up to 4 threads. Compressing objects: 100% (118/118), done. Writing objects: 100% (124/124), 19.73 KiB | 0 bytes/s, done. Total 124 (delta 66), reused 1 (delta 0) remote: Compressing source files… done. remote: Building source: remote: remote: —–> Ruby app detected […]

如何为开发和生产指定不同版本的gem

我需要有不同版本的gem用于开发和生产,所以我将以下内容放在我的gemfile中。 group :development, :test do gem ‘rspec-rails’, ‘2.11.0’ gem ‘bcrypt-ruby’, ‘3.1.2’ end group :production do gem ‘rails_12factor’ gem ‘bcrypt-ruby’, ‘3.0.1’ end 但如果我尝试bundle install甚至只是rails console我得到上述错误 我试过了 bundle install –without production 但我仍然收到错误消息。 仅供参考:我需要这样做,因为我要通过rails教程,在windows,ruby 2.0.0和bcrypt以及Heroku之间出现冲突,所以我在windows上使用bcrypt 3.1.2(对活动进行了修改)在Heroku上记录gemfile)和bcrypt 3.0.1。 有关更多详细信息,请参阅此内容: 在Windows上使用带有ruby2.0的bcrypt 3.0.1的问题 我基本上完成了第一个答案中提到的内容 编辑 ################################################################### 正如下面的答案所指出的,我真的应该在生产和开发中使用相同的版本(即使我只是在教程中工作)。 我最终做的是猴子修补ActiveModel使用 gem ‘bcrypt-ruby’, ‘3.1.2’ 而不是 gem ‘bcrypt-ruby’, ‘~> 3.0.0’ 在secure_password中。 我通过将以下内容放在lib / secure_password_using_3_1_2.rb中来完成此操作 module […]