I'm using twitter-bootstrap-rails gem. Last night I updated my gems, and tried using the icon-globe but all i got was an empty space.
here are my Gemfile:
gem 'jquery-rails'
gem 'therubyracer'
gem 'mongoid'
gem 'bson_ext'
gem 'bson'
gem 'mongo'
gem 'devise'
gem 'twitter-bootstrap-rails', :git => 'git://github.com/seyhunak/twitter-bootstrap-rails.git'
I tried rake tmp:clearbut this didn't worked too
I just ran into this the other day as well. I have my Rails servers setup so that I can run multiple Rails apps on the same server under their own suburi. Apparently the asset-path helper in the bootstrap_and_overrides.css.less is not including the relative path for the sprites and instead points the background-image url to /assets instead of /suburi/assets.
Following what I found here: https://github.com/rails/rails/issues/3365 I was able to gather that I needed to do the folllowing when precompiling assets:
RAILS_RELATIVE_URL_ROOT="/suburi" rake assets:precompile
This sets the relative root within the environment when you precompile and everything then works as it should.
The thing that really threw me for a loop was that in development everything worked just fine. As soon as I pushed it to the production server the icons stopped showing up. I kept thinking there was an issue with my server or my code. All along it was just the asset-path helper not including the suburi when I precompiled my assets.
Just set your full suburi path in the RAILS_RELATIVE_URL_ROOT environment variable before running the precompile and it will work.
Update: You can set this variable in the config/application.rb file by adding
config.action_controller.relative_url_root = '/suburi'
This would be the best option as it would not require extra typing when deploying.
You can read about it here:
http://guides.rubyonrails.org/configuring.html#configuring-action-controller
did you try:
bundle exec rake assets:precompile
on your production environment?
Related
My Active Admin Layout Not Comes in Production Environment.
I added in Gemfile
gem 'activeadmin', github: 'gregbell/active_admin'
See My Active Admin Page
Help me Please.
Thanks In Advance
Im using Rails 4 and after running the server in RAILS_ENV=production i would get the same layout as you did, although it works in the development environment. after searching in the web for different answers that one that work for me was the next. Heroku does NOT compile files under assets pipelines in Rails 4 i find the answer here.
add rails_12factor to your gemfile
gem 'rails_12factor', group: :production
then
bundle install
and then restart your server
i did some modifications to config/application.rb file but it never worked for me (somthing to do with precompile assets) therefor i dont think it's necessary.
hope it helps
I have an existing Rails 3.2.14 application that I am trying to add zurb-foundation to. I have added the zurb-foundation gem and run the installation generator.
My problem is that, whenever I try to load a page, I get this error:
couldn't find file 'foundation'
when Sprockets hits the
//= require foundation
line in application.js
The problem appears to be that the directory with the assets from the zurb-foundation gem are not being added to the load path. In contrast, I have an application that I generated more recently, including zurb-foundation from the beginning, and #asset_paths.asset_environment.paths includes the following
"/usr/local/var/rbenv/versions/1.9.3-p327/lib/ruby/gems/1.9.1/gems/jquery-rails-3.0.4/vendor/assets/javascripts",
"/usr/local/var/rbenv/versions/1.9.3-p327/lib/ruby/gems/1.9.1/gems/coffee-rails-3.2.2/lib/assets/javascripts",
"/usr/local/var/rbenv/versions/1.9.3-p327/lib/ruby/gems/1.9.1/gems/zurb-foundation-4.3.0/scss",
"/usr/local/var/rbenv/versions/1.9.3-p327/lib/ruby/gems/1.9.1/gems/zurb-foundation-4.3.0/js"
which are not included in the asset load path in the app I am updating. Instead, I am getting (with p #asset_paths.asset_environment.paths in the better_errors diagnostic window)
"/usr/local/var/rbenv/versions/1.9.3-p327/lib/ruby/gems/1.9.1/gems/jquery-ui-rails-4.0.4/app/assets/images",
"/usr/local/var/rbenv/versions/1.9.3-p327/lib/ruby/gems/1.9.1/gems/jquery-ui-rails-4.0.4/app/assets/javascripts",
"/usr/local/var/rbenv/versions/1.9.3-p327/lib/ruby/gems/1.9.1/gems/jquery-ui-rails-4.0.4/app/assets/stylesheets",
"/usr/local/var/rbenv/versions/1.9.3-p327/lib/ruby/gems/1.9.1/gems/jquery-rails-3.0.4/vendor/assets/javascripts",
"/usr/local/var/rbenv/versions/1.9.3-p327/lib/ruby/gems/1.9.1/gems/coffee-rails-3.2.2/lib/assets/javascripts"
interestingly, if I run the console in development mode and look at Rails.application.config.assets.path, it includes:
"/usr/local/var/rbenv/versions/1.9.3-p327/lib/ruby/gems/1.9.1/gems/jquery-ui-rails-4.0.4/app/assets/images",
"/usr/local/var/rbenv/versions/1.9.3-p327/lib/ruby/gems/1.9.1/gems/jquery-ui-rails-4.0.4/app/assets/javascripts",
"/usr/local/var/rbenv/versions/1.9.3-p327/lib/ruby/gems/1.9.1/gems/jquery-ui-rails-4.0.4/app/assets/stylesheets",
"/usr/local/var/rbenv/versions/1.9.3-p327/lib/ruby/gems/1.9.1/gems/jquery-rails-3.0.4/vendor/assets/javascripts",
"/usr/local/var/rbenv/versions/1.9.3-p327/lib/ruby/gems/1.9.1/gems/coffee-rails-3.2.2/lib/assets/javascripts",
"/usr/local/var/rbenv/versions/1.9.3-p327/lib/ruby/gems/1.9.1/gems/zurb-foundation-4.3.1/scss",
"/usr/local/var/rbenv/versions/1.9.3-p327/lib/ruby/gems/1.9.1/gems/zurb-foundation-4.3.1/js"
and that DOES include the zurb-foundation asset paths.
I have included gem 'zurb-foundation' in the assets group, in the development group, and outside any group. I am using zurb-foundation-4.3.1 in the new app.
My Gemfile assets group is:
group :assets do
gem 'sass-rails'
gem 'coffee-rails'
gem 'uglifier'
gem 'compass-rails'
gem 'zurb-foundation'
end
This problem seems similar to Sprockets::FileNotFound with ZURB Foundation, although Jurriaan did not mention the asset load path.
Any idea what I could be missing?
Thanks!
Have you tried restarting the webserver?
Update:
You said it runs fine in development, Have you tried to rake assets:clean and rake assets:precompile?
It was a problem with a gem that was preventing foundation's entries being added to the load_path. The gem involved was mongomapper-versioned.
By not loading that gem, the problem resolved. By adding the gem back, the problem recurs.
That gem has not had any activity for two years. I guess it's time to find something else.
/assets/fancybox-40d79ef494fcf5ca4727cb13b9e69c33.png 404 (Not Found)
This is see when i go on my page. Images for fancybox-rails gem does not load - i talk about images like close button ,background and other fancybox-rails css images. What i can do? I had that same problem with all my css and i change
url('something.jpg')
to
image-url('something.jpg')
but here i havent got any css file for this fancybox-rails gem , everything is in jquery.fancybox.js
On localhost everything works only on production server does not
In case you use rails 4, the official fancybox-rails gem is currently not fully compatible with rails 4. You can use the gem from greinacker instead.
In your Gemfile, use:
gem 'fancybox-rails', :github => 'greinacker/fancybox-rails', :branch => 'rails4'
See https://github.com/hecticjeff/fancybox-rails/pull/26 for more informations.
Your question is a bit unclear, I'm not well versed in fancy box but rather the assets pipeline.
Go to your vendor directory and search for the assets there. if they don't exist manually place them in there.
If everything seems correct in your assets directory then it sounds like you need to precompile your assets for production.
bundle exec run rake assets:precompile
I'm using ckeditor_rails (here) but when i uploaded my app to heroku, all my editors wasn't 'ck'ed (lol)
so I started my app (unicorn_rails -E production) and got the same result: even locally, the editors wasn't showing. if I start in development, they work pretty well...
here are my Gemfile (part of)
gem 'mongoid_slug'
# gem 'will_paginate'
gem 'will_paginate_mongoid'
gem 'bootstrap-will_paginate'
gem 'ckeditor_rails', :require => 'ckeditor-rails'
I tried rake tmp:clearand rake assets:precompiled and tried delete the manifest.yml too. none of these commands worked.
am I missing something?
thanks in advance
Did you include the ckeditor-jquery
Make sure that your javascript and css files are included and precompiled
I'm getting these warnings when trying to use sass in Rails 3.1 rc1.
WARN: tilt autoloading 'sass' in a non thread-safe way; explicit require 'sass' suggested.
WARN: tilt autoloading 'sass/plugin' in a non thread-safe way; explicit require 'sass/plugin' suggested.
This is my Gemfile.
gem "rails", "~> 3.1.0.rc1"
gem "haml"
gem "sass"
I've tried to create a file called sass.rb inside the config/initializers containing this code.
require "sass"
Changing the Gemfile to this.
gem "rails", "~> 3.1.0.rc1"
gem "haml"
gem "sass", require: false
But the warnings remains.
Anyone knows how to solve it?
I found the code that is printing the warnings, if that is to any help.
have you tried doing this in Gemfile?
gem "sass", :require => 'sass'
this is an explicit call, without using initializers. by the way consider that you're using a rc1 release.
I had the same problem, and was able to solve it by compiling assets locally before pushing to Heroku as mentioned in the article Rails 3.1+ Asset Pipeline on Heroku Cedar
RAILS_ENV=production bundle exec rake assets:precompile
I also tried Itecedors suggestion which also worked:
While precompiling assets, in Rails 3.1.1 and up, you can prevent initializing
your application and connecting to the database by ensuring that the following
line is in your > config/application.rb:
config.assets.initialize_on_precompile = false
On Heroku I was getting this same error and googling did not help me find the problem, so I thought I would add what I found to this questions since it comes up first when searching.
The problem was NOT this error, it was a smaller error while pushing the code up to Heroku. After the gems are listed these lines got me on the path to the answer:
Running: rake assets:precompile
rake aborted!
Tasks: TOP => environment
(See full trace by running task with --trace)
Precompiling assets failed, enabling runtime asset compilation
Injecting rails31_enable_runtime_asset_compilation
Please see this article for troubleshooting help:
http://devcenter.heroku.com/articles/rails31_heroku_cedar#troubleshooting
I had just been configuring Redis on Heroku so I knew that the problem had to be something related to those changes. At that URL I found this:
While precompiling assets, in Rails 3.1.1 and up, you can prevent initializing your
application and connecting to the database by ensuring that the following line is in your > config/application.rb:
config.assets.initialize_on_precompile = false
Adding the on_precompile = false line fixed all the errors, including the original one in this question.