Images load slowly in ruby on rails - ruby-on-rails-3

I have developed a website using ruby 1.9.3 and deployed in on aws server through passenger. But my website takes time in loading.
I am using passenger in: production mode
I am worried because i reduced the size of images to 100kb even then they took time in loading due to which animation can't occur properly.
I have assets precompile :true
in production environment.
Is there any way to load images fast.
Please help i am new to ruby
Thanks & Regards
Rajat

If you are using asset pipeline, then you need precompile assets using the rake task and deploy the application to production.
bundle exec rake assets:precompile
Refer to below links for more info
http://guides.rubyonrails.org/asset_pipeline.html
http://stackoverflow.com/questions/8821864/config-assets-compile-true-in-rails-production-why-not

Related

Best Asset Pipeline Setup for Ruby on Rails and Heroku

I am running Rails 3.2.12 and deploying to Heroku.
Currently, to get my css files to update locally I need to run
RAILS_ENV=production bundle exec rake assets:precompile
I was wondering how I can get my asset pipeline to start automatically updating upon sacing again in development mode.
I have read the following article, but I am unsure which set up to follow. I am just using basic scss, nothing crazy.
https://devcenter.heroku.com/articles/rails-asset-pipeline
Thank you.

How to find actually necessary gem set

when I was created a new rails app with rails new app_name. I found that many gems were installed and I suspect I will not use many of them. It is possible to have a minimal set of gems when I do a rails new?
Thank you.
Additional information:
I'm concerned about this because when I push a fresh new rails app onto heroku, I realized many gems are installed, and I'm not using most of them.
What ending up within your application in controlled through the "Gemfile" in your root directory. Running bundle / bundle install will install the gems and their dependencies.
But having gems available in the system doesn't mean your application will rely on them.
Further reading: http://gembundler.com/gemfile.html

Pushing new Rails 3.1 app to Heroku causing problems with Sorcery mod (requiring bson-1.4.1)

I have an app that runs great locally. Everything seems to be set up correctly to transfer over to Heroku, including the Postgres gem (and dev was done using a postgres server).
The problem is, when I try to push it up, I get error messages surrounding the three currently problematic dependencies, bson_ext, bson, and mongoid, 1.4.1. It seems that Sorcery requires these (at 1.4.1) to run. I got them installed locally by downloading the manually, but they were yanked from the online sources. So when Heroku tries to find them, it can't, and it aborts. I tried specifying to use 1.4.0 for all of them, and the app then installs fine (and does the database setup stuff for the Cedar stack, etc).
The problem is that when I load the app on their server, I get the generic "oops, there's been a problem" Heroku message. Upon checking the actual heroku log, I can't really find anything wrong. What is the way to make this work?
Thanks for your help.
I ran into the same problem, and I was able to get past it by specifying version 1.3.1 for the mongo, bson, and bson_ext gems. I just put this in my Gemfile:
gem 'mongo', '1.3.1'
gem 'bson', '1.3.1'
gem 'bson_ext', '1.3.1'

Rails assets images in production

I found some strange behavior of assets images
If I run unicorn in production mode at hosting - /assets/image.png - server give me blank image ie file exist, but size=0 . In same time at localhost I run in unicorn development mode - and all works fine, Then I run webrick at hosting - images are display fine. After that I run unicorn in production mode at localhost and images stops display, then I run unicorn in development images already doesn't work.
Rails 3.1.0.rc6, after that I update to rc8 at hosting but nothing happened
Maybe production mode build some cache, which remains forever?
There are different things that may go wrong, so here the ideas you have to check:
There is a known error in Rails 3.1, that the precompilation of assets does not work properly. See Upgrade to Rails 3.1.0 from rc6, asset precompile fails for a question with a solution.
I had problems with creating precompiled assets for production. The following worked for me (after fixing the error above):
Ensure that your application is not running in production mode.
Call bundle exec rake assets:clean. This will clean all resources hanging around.
Call bundle exec rake assets:precompile afterwards. As a result, the directory /public/assets should be filled with assets with the hash appended (e.g. icon_add-96985e087048a8c2e09405494509750d.gif instead of icon-add.gif).
Start your server in production mode.
Depending on the browser I used, I had to refresh or even clear all caches. Especially Chrome was very nasty in caching resources that he should not cache.
I hope some of the ideas will help you find the source of your problem.

CSS files, JavaScript files and images not rendering in production server

When I start my server in the production environment, my CSS files, Javascript files, and images are not showing up. I`m using Webrick for my production server and Rails 3.0.3.
Try this:
config.serve_static_assets = true
in your rails_app_path/config/environments/production.rb.