Ajax_pagination gem loading image missing in Rails 4 production - ruby-on-rails

I was using this gem successfully in production until moving to Rails 4. Now the loading image is not working properly. I have reached out to the developer, without assistance, so I would like to ask your help on this one.
Here is the file which I believe is involved:
https://github.com/ronalchn/ajax_pagination/blob/1297da84ead61f206e30f3d6bae2da6a551fed14/lib/generators/ajax_pagination/assets_generator.rb
Can this repo be modified to correctly show the image in Rails 4?
At the moment, I'm just seeing a broken image link.

The fix was simple in the end I just downloaded the original image:
https://github.com/ronalchn/ajax_pagination/blob/master/lib/assets/images/ajax-loader.gif
and put it into my existing assets/images directory! Bingo!

Related

Renaming the path for asset_url in rails

I am using the WickedPDF gem and it does not properly render images within PDF files unless the URL to the image is pointing to http:// instead of https://. Since my rails application uses HTTPS, I am trying to figure out how to manipulate asset_url to point to http://localhost rather than https://path-to-my-site/asset/image.png.
Is there currently any way to do this with asset_url?
To my knowledge this is an old issue, and should easily be solved by using a more recent version of wkhtmltopdf-binary?
See the link to an issue from 2014: https://github.com/mileszs/wicked_pdf/issues/344
In the issue they mention the wkhtmltopdf-binary-edge gem, however when I upgraded to it I had a lot of weird cosmetic changes.
I opted to use the
gem "wkhtmltopdf-heroku"
even though I do not deploy on heroku but on a ubuntu 18.04 machine.

Heroku and Rich Editor - Clearing uploaded images

I'm using Rich Editor for my Ruby on Rails app. And I'm have a problem when I'm deploying my code to Heroku. When I'm deploy new code to Heroku, all old assets removes. Also, all uploaded images by Rich Editor too removes. Maybe, I'm forgot to set some settings?
Thanks!
There are multiple reasons for this kind of issue. Typically it is either has to do with the way Heroku precompiles the assets or that the CSS is not pointing to the proper file if the asset is stored on S3.
One such being this:
http://natashatherobot.com/rails-4-heroku-assets-not-found-css-image/
Another being this:
Can't get CSS working on Heroku using Rails 4 with bootstrap-sass gem
Edit
Okay. It looks like you need to change the way you are managing your assets.
One solution is to use S3. A good explanation on how to do that: https://devcenter.heroku.com/articles/s3
I haven't used this gem but it looks promising:
https://github.com/rumblelabs/asset_sync
Another solution is to keep your local asset file in synch with production. You could do this by pulling down a copy of your asset directory from heroku each time you do development.

Rails 3.2 Deploy to Subdirectory Kind of Working

I am trying to deploy my Rails 3.2 app to a subdirectory, /support, on an Apache server. Consulting the various posts, the only solutions that seem to have helped involve setting up a symbolic link on the server and changing css image references slightly (two dots '..' required before /assets in the css url references--I can't seem to find the post on that one now). I am getting success in deployment to production with Capistrano, but then strangely after awhile something changes, the /support reference breaks and the stylesheets don't load. Any suggestions?
oh no, please don't deploy rails as sub-uri in that way, you are making yourself in trouble.
So far as I see, ( according to this post: http://kb.site5.com/ruby-on-rails/how-to-deploy-a-rails-3-application-to-a-sub-directory/ ) you created soft links, modified your routes.rb, and changed RAILS.root in environment.rb, and also changed your assets files... all of these make your rails app messed up.
I suggest you use 'passenger' as rails server and checkout this post: http://www.modrails.com/documentation/Users%20guide%20Nginx.html#deploying_rack_to_sub_uri, it's quite easier and simplier

CKEditor won't link files (backed by rails, mongoid, paperclip, s3)

I'm having issues with CKEditor. I can upload and insert pictures without issues, but when I try to do the same with files, the link to my file is set to something like javascript:void(0)/*130*/, with the number changing. This is happening on FF/Safari/Chrome.
My app runs on rails 3.1.3, using MongoDB/Mongoid as database/ODM, with paperclip for handling attachments and using S3 for hosting assets. When I explore my bucket I can see that the files are uploaded correctly, so the problem (probably) come from somewhere else. I'm using this gem, and both the rc2 & the master branch doesn't fix that.
Thanks for your time.
Well it's been a while. I solved it by forking the gem (cf ksol/ckeditor), but the diff is too obfuscated to remember what was wrong. Hopefully the original gem is working now.

Rails 3.1 image asset timeout

I'm having intermittent issues with images on Rails 3.1.
The file in question is a simple PNG; all other images are working correctly. If I vist the asset path directly the image works as expected. Restarting the server (Webrick, in development) does not help. Clearing the browser cache does not help.
When I reload the page the image shows but the browser indicates it is still loading. After 30 seconds the request times out and the image is replaced with a broken image indicator.
Here are a few supporting images:
https://skitch.com/matt_darby/fahke/oops-google-chrome-could-not-connect-to-localhost-3000
https://skitch.com/matt_darby/fahkp/oops-google-chrome-could-not-connect-to-localhost-3000
https://skitch.com/matt_darby/fahkw/contact.html.haml-documents-code-protectedmethod.com-app-views-pages-vim
I too had this issue and Richard Hulse's comment above to his own answer: "delete the files in tmp/cache/assets and restart' fixed it for me. Thanks Richard.
I suspect this is not working because you are running in production mode locally, or have digest turned on in your config.
In your view you should be using the asset_tag helper:
%img{ :src => asset_path('/assets/phone.png') }
This ensures that the correct path (with the fingerprint) is rendered into the view.
The code you have will work in development mode (or without digests), but will break when they are on, or in production.
If this is an upgraded app, check the Rails asset pipeline guide for the correct stuff to paste into your config files.

Resources