Rails 4 Assets are not compiling in production environment - ruby

My app is running in dev environment. I am using JQCloud.
Its working fine in development mode but when i run following command
RAILS_ENV=production rake assets:precompile
All assets precompile but after running my server in production mode i am getting following error.
jQCloud is not a function
application.css.scss
*= require_tree .
*= require_self
*= require font-awesome
*/
appication.js
//= require jquery
//= require jquery_ujs
//= require bootstrap-sprockets
//= require_tree .
dashing widegts index.js
//= require_tree .
//= require highcharts/highstock
//= require highcharts/highcharts-more
//= require highcharts/modules/exporting
//= require jquery-ui
//= require jqcloud
Facing error following errors
Uncaught TypeError: $(...).jQCloud is not a function
Uncaught ReferenceError: Highcharts is not defined

Related

Having issues loading reset-client on Debian distro

I'm trying to run an application that uses rest-client version 2.0.1, however when I run the application I'm getting
/opt/whitewidow/lib/imports/constants_and_requires.rb:6:in require': cannot load such file -- rest-client (LoadError) from /opt/whitewidow/lib/imports/constants_and_requires.rb:6:in<top (required)>'
from whitewidow.rb:2:in require_relative' from whitewidow.rb:2:in
What I've tried to do is edit the code to use restclient instead of rest-client but that just throws the same issue, I tried install a version lower with gem install rest-client -v 2.0 I get the same error.
Now here's the weird part, the application runs on Windows 7, but not on a Debian distro, is there a trick to running rest-client on a Linux distro? here's all the requirements:
require 'rubygems'
require 'bundler/setup'
require 'mechanize'
require 'nokogiri'
require 'rest-client'
require 'timeout'
require 'uri'
require 'fileutils'
require 'yaml'
require 'date'
require 'optparse'
require 'tempfile'
require 'socket'
require 'net/http'
require 'ipaddr'
require 'csv'
If you bundled the application on windows it will not execute properly. This is because it compiles with the windows binaries.
Try deleting your Gemfile.lock and rebundling.

How to get bootstrap helpers using Rails 5 and Bootstrap 4

I'm working on an application upgrade from rails 4.2 (with bootstrap 3) to rails 5 (bootstrap 4.0.0.alpha3.1).
I'm using the official bootstrap-rubygem https://github.com/twbs/bootstrap-rubygem and I'm following the steps on the documentation, but the problem I have is the absence of the classical bootstrap helpers. I.e.: menu_group, nav_bar, menu_item, dropdown_divider, etc...
Is there any way to get these helpers back as on bootstrap3?
The relevant configuration I have, regarding this issue, is:
Gemfile:
gem 'rails', '~> 5.0.0'
gem 'sass-rails', '~> 5.0'
gem 'jquery-rails'
gem 'turbolinks', '~> 5'
gem 'bootstrap', '~> 4.0.0.alpha3.1'
application.js:
//= require jquery
//= require jquery_ujs
//= require turbolinks
//= require bootstrap-sprockets
//= require_tree .
application.scss:
#import "bootstrap";
This is due to bootstrap framework has large number of changes.

Rails precompile assets on Heroku Sprockets::FileNotFound

I try to deploy my simple Rails app to Heroku. This app is just attempt to use bower with Heroku.
Unfortunately I have problems with precompile assets on Heroku.
This gives me error Sprockets::FileNotFound.
remote: -----> Preparing app for Rails asset pipeline
remote: Running: rake assets:precompile
remote: rake aborted!
remote: Sprockets::FileNotFound: couldn't find file './app/App'
remote: (in /tmp/build_fe6dc0e2c0063705b279b26e4aa2432d/app/assets/javascripts/application.js:12)
I don't know what can be the cause. App.js is my own file and it surely exists.
Need to mention that rake assets:precompile work properly on my local machine.
This is my applications.js which includes all other files
//= require jquery
//= require jquery_ujs
//= require vendor/angular/angular
//= require vendor/angular-route/angular-route
//= require vendor/angular-resource/angular-resource
//= require vendor/angular-sanitize/angular-sanitize
//= require vendor/moment/moment
//= require vendor/angular-moment/angular-moment
//= require ./app/App
//= require ./app/router
//= require_tree ./app/controllers
//= require_tree ./app/directives
//= require_tree ./app/filters
In some similar questions I found advice to run heroku repo:purge_cache.
But this failed to me too.
~/tmp/repo_tmp $ cd unpack
~/tmp/repo_tmp/unpack $ tar -zxf ../repo-cache.tgz
gzip: stdin: not in gzip format
tar: Child returned status 1
tar: Error is not recoverable: exiting now
All source code is published at GitHub
https://github.com/ivanovalexey/bowerrr
Could some one help me figure it out?
Thank you.
Solved. The problem was with file name ./app/App.js. I renamed it to ./app/main.js and it worked. Still wonder why it doesn't matter locally.

rails4 + bootstrap displays the error as "variable #zindex-modal-background is undefined"

I'm trying to make the project that use bootstrap on rails4.1.6.
Here is gemfile:
gem 'therubyracer'
gem 'less-rails'
gem 'twitter-bootswatch-rails', '~> 3.1.1'
gem 'twitter-bootswatch-rails-helpers'
$ bundle install was successful.
and settings of bootswatch
$ rails g bootswatch:install cerulean
$ rails g bootswatch:import cerulean
$ rails g bootswatch:layout cerulean
app/assets/stylesheet/application.css
*= require cerulean/loader
*= require cerulean/bootswatch
app/assets/javascript/application.js
//= require cerulean/loader
//= require cerulean/bootswatch
but $ rails s and when I viewed the site , appears the following error:
variable #zindex-modal-background is undefined
(in /Users/ko2ic/sample/app/assets/stylesheets/cerulean/loader.css.less)
How do you solve it doing?
It was resolved by adding the next code:
assets/stylesheets/cerulean/variables.less
#zindex-modal-background: 0;
reference:
http://github.com/scottvrosenthal/twitter-bootswatch-rails/issues/30

Asset pipeline in a Rails 3.2.11 app works fine with Ruby 1.9.3 but stops working in Ruby 2.0.0

My asset pipeline was working fine in Ruby 1.9.3. When I upgrade to 2.0.0 It stops working.
In Gemfile:
gem 'jquery-rails'
In application.js file:
//= require jquery
//= require jquery_ujs
//= require bootstrap-affix
//= require bootstrap-alert
...
//= require jquery_nested_form
//= require sitengine.js
//= require_tree .
Result from .../assets/application.js in browser:
//= require jquery
//= require jquery_ujs
//= require bootstrap-affix
//= require bootstrap-alert
...
//= require jquery_nested_form
//= require my_app.js
//= require_tree .
;
Two questions:
Have you experienced this? If you have, would love to have a comment from you.
Have you found a solution? (Thanks in advance for your answer.)
Thanks!
I updated all my gems with bundle update and that did the trick.
No idea why, probably some gems were updated for ruby 2.

Resources