GC.stat is undefined on Heroku's Cedar stack - ruby-on-rails

This is currently demonstrated on my playground app, visiting it results in a 500, works now having deployed the fix given in the answer.
The error is was:
Processing by GcController#show as HTML
Completed 500 Internal Server Error in 0ms
NoMethodError (undefined method `stat' for GC:Module):
app/controllers/gc_controller.rb:4:in `show'
Conversely if you grab the Rails app from Github.
Then RAILS_ENV=production rails server and go to /.
You'll get:
{:count=>131, :heap_used=>193, :heap_length=>345, :heap_increment=>152, :heap_live_num=>127915, :heap_free_num=>29930, :heap_final_num=>0}
Is it safe to assume Heroku is using a patched GC?
Has anyone else encountered this? There doesn't appear to be any documentation about it.
I'm seeing some conflicting memory usage behaviour locally vs on Heroku, which is why I'm trying to GC.stat. I wonder if the differences could be accounted for by patched GC.
I also opened a Heroku issue for this.

Answer graciously stolen from JD at Heroku:
Cedar uses 1.9.2-p290 by default. I'm not sure if GC.stat is in 1.9.2
offhand, but it appears to not be on Heroku for sure. We don't patch
the Ruby versions we run.
I can confirm that if you specify ruby '1.9.3' in your Gemfile, GC.stat will work fine.

Related

Rails server keep failing. NoMethodError `new_with_config'

I installed rails recently and I have been having quite a bit of trouble just trying to install everything, but it is finally done and now when I try to launch a rails server I always get an error and the server ends up stoping at that exact moment.
Here is what it says:
NoMethodError `new_with_config' for
ActionDispatch::Routing::RouteSet:Class.
I am using Rails version 5.0.0.1

Rails accessing Desk.com api results in RuntimeError concerning FaradayMiddleware

I was pairing with a coworker, and after writing a feature using the desk.com api, everything was working fine. It was deployed to a staging server, where it too worked fine. However, when I run the code on my local dev machine, when I try to query the api (for example, request all the users on our account), I get a runtime error.
I'm using the desk ruby gem: https://github.com/chriswarren/desk
Here is a session in the rails console:
[1] pry(main)> Desk.users
RuntimeError: missing dependency for FaradayMiddleware::Deashify: undefined method `type' for class `Hashie::Mash'
from /home/rooney/.rbenv/versions/2.1.6/lib/ruby/gems/2.1.0/gems/faraday-0.9.1/lib/faraday/middleware.rb:20:in `new'
This is the error I get. I haven't been able to find any info on this error. If anyone needs more info just ask.
Methods "type" and "id" are removed in Hashie version >= 3.4.2
You can fix by rolling back to Hashie v3.4.1
Are you using bundle exec? It's possible that you're using the wrong version of a gem. Try uninstalling versions of the gem other than the one you need.

Unable to see Ruby on Rails App deployed on Heroku?

I have successfully deployed Ruby on Rails app on Heroku. But when I visit the URL given by Heroku, error says: "The page you were looking for doesn't exist."
URL - https://cryptic-waters-2558.herokuapp.com/
Please help.
Your application is up and running, since the error message comes from Webrick. Probable cause of this error is lack of some initial data (maybe you forgot to run heroku run rake db:seed), which causes ActiveRecord::RecordNotFound error. You can check this easily with heroku logs or heroku logs -t, which works similar to tail -f.

RoR deploying DataTables to Heroku

Website works locally. When publishing to heroku get an error in the logs:
ActionView::Template::Error (couldn't find file 'dataTables/jquery.dataTables.bootstrap'
Thoughts?
Figured it out. Essentially I had the gem in the assets group. As soon as I relocated it, the push to heroku worked.

Asset Pipeline Issue Upgrading Rails 3.0 app to Rails 3.2

I've followed the instructions for the Railscast on upgrading a Rails app to 3.1:
http://railscasts.com/episodes/282-upgrading-to-rails-3-1?view=asciicast
The server doesn't recognize requests for any folders within app/assets.
Just to be sure, I've run rake rails:update and diff'd the files against what we have. It looks like every old config flag has been removed and every new config flag has been set.
When I load the homepage, I see the following in the javascript console:
"NetworkError: 404 Not Found - http://localhost:3000/assets/application.js"
"NetworkError: 404 Not Found - http://localhost:3000/assets/application.css"
Does anyone have any suggestions? I'm completely stumped, short of creating a new app and moving things over.
The issue was with the active_reload gem in our project. Disabling it in the gemfile and running bundle install fixed the issue
Apparently the first statement on the project page is that it's incompatible with Rails 3.2.x.

Resources