RoR deploying DataTables to Heroku - ruby-on-rails

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.

Related

Rails on Heroku - Site does not load - ActionView::Template::Error (The asset "image.jpg" is not present in the asset pipeline.)

I've build a simple website, using Rails so I can deploy it to Heroku. It runs perfectly locally, everything works fine. It deploys fine to Heroku but when opening the webpage (http://a-clean.herokuapp.com/) I get the following error displayed:
We're sorry, but something went wrong.
If you are the application owner check the logs for more information.
When I check the logs (running heroku logs in terminal) it shows the error:
ActionView::Template::Error (The asset "a_clean_sample_1.jpg" is not present in the asset pipeline.)
So far this is just a one-page website with a couple of partials. Here is the github repository: https://github.com/webbc99/a-clean
The image it's failing on is loaded in app/views/welcome/home.html.erb line 57.
Rails version 5.1.6, Ruby version 2.5.0
I've double checked that the images are in fact in the app/assets/images folder, and the image_tags are using the file extensions.
I've tried running heroku run rake assets:precompile, and I've tried using the rails12factor gem and also without it. I have tried changing config.assets.compile = false to true in the config/environments/production.rb which did get the page to load but all of the images were ignoring styling and were huge.
What is really confusing me is that I have deployed several other rails apps, same rails version, same ruby version, and none of these have had this issue before.
Here is a working app:
https://github.com/webbc99/presumptuous
https://presumptuous.herokuapp.com/
Any help would be greatly appreciated, been googling this for hours with no luck.
It's the simplest way to fix this problem is; You need to run as follows;
rails assets:precompile RAILS_ENV=production
git add .
git commit -m {message}
git push heroku master (push the code to the heroku again)
I tried to do it from your code and work fine.

Active Storage on Heroku

all. Has anyone had success deploying previewable Active Storage on Heroku. I followed the guidance on the Heroku Devcenter, added the buildpack, but still no love. When running which ffmeg or which poppler from heroku bash, I get no response which indicates that the necessary binaries did not get installed.
Any ideas?

Cloudinary missing cloud_name in development

I am using the cloudinary with my application to upload images but I seem to get this error on development. I have the site launched and it gives this error when I try to upload an image.
Uncaught Missing required option: cloud_name
When I run it in development (localhost), it doesn't throw this error and works perfectly. Is this an issue in my production.rb or development.rb files? Did I forget to include something?
It's actually because I never pushed my keys to heroku with figaro. I'm using a Backbone.js frontend and a rails backend and I ignore my cloudname and API keys in gitignore so it was never on heroku.
I had to run:
figaro heroku:set -e production
and then it all worked :)

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.

GC.stat is undefined on Heroku's Cedar stack

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.

Resources