ckeditor_rails doesn't work in production - ruby-on-rails

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

Related

Active Admin Layout Not Display Proper In Production Environment

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

zurb-foundation gem not added to asset path in existing Rails 3.2 application

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.

Fancybox-rails gem does not load assets

/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

Ruby Gem works when pointing to local gem but not once published

Here is the situation:
I decided to start moving all the js code that I reuse in every project in a gem and created the gem in:
/Users/alain/Dropbox/rails_app/alain_toolbox
So in my project, to test if things are working, I add this line to the gem file:
gem 'alain_toolbox', '=0.0.1', path:'/Users/alain/Dropbox/rails_app/alain_toolbox
everything works fine.
Then, I do a
gem build alain_toolbox.gemspec
gem push alain_toolbox-0.0.1.gem
and everything seem to work. So I replace the gem require in the gemfile with:
gem 'alain_toolbox'
then do a bundle and the gem install successfully. The problem is when I open up the app, I get an error that it cant find 'alain_toolbox' in the line
<%= javascript_include_tag "application" %>
and application.js looks like this:
//= require alain_toolbox
which was working when I was in local.
So the question is: why?(!)
Thx.
Found the error: I dont know how, but I forgot to do a 'git add' on the asset files. Once the file were added and the gem rebuilt, everything worked as expected.
The Rails Guide indicates the gem needs to implement a rails engine. In addition, the assets would still need to be in one of the specified directories within the gem (app/assets, lib/assets, or vendor/assets). I'm assuming in the local case somehow your gem is already in that path.
According to this AsciiCast you can see the asset pipeline paths in the rails console by printing the Rails.application.config.assets.paths configuratio
Related question: Get Gem vendor files in asset pipeline path

icon-globe not found after update gem twitter-bootstrap-rails

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?

Resources