timroman
timroman

Reputation: 1394

JQuery Working in Development, Not Production on Heroku Cedar

jQuery is working for me locally in development but not in production on Heroku Cedar. I'm very new to Rails, so I'm trying to learn this the right way rather than just slapping the code into a view. I don't see any errors in the server log. I'm compiling my assets locally with:

bundle exec rake assets:precompile

Then pushing the whole app to Heroku. I've tried several different gem combinations, current configuration:

Gemfile

source 'https://rubygems.org'

gem 'rails', '3.2.11'
gem 'bcrypt-ruby', '3.0.1'
gem 'execjs'
gem 'jquery-rails'
gem 'will_paginate', '~> 3.0.0'
gem 'sass-rails',   '~> 3.2.3'
gem 'bootstrap-sass', '~> 2.2.2.0'
gem 'bootstrap-will_paginate', '0.0.6'
gem "friendly_id", "~> 4.0.9"
gem 'twitter'
gem 'devise'
gem 'cancan'
gem "paperclip", "~> 3.0"
gem "cocaine", "= 0.3.2" 

group :production do
  gem 'pg'
  gem 'thin'
end
group :development, :test do
  gem 'sqlite3'
end

# Gems used only for assets and not required
# in production environments by default.
group :assets do
  gem 'coffee-rails', '~> 3.2.1'
  gem 'uglifier', '>= 1.0.3'
end

application.js

//= require jquery
//= require jquery_ujs
//= require bootstrap
//= require_tree .

Upvotes: 0

Views: 2891

Answers (2)

Nelcifran Pires
Nelcifran Pires

Reputation: 1

In my case ,I'm just run theses commands:

  • heroku run gem cleanup
  • rake assets:precompile (locale)
  • git push heroku master After this its works for me in rails 5

Upvotes: 0

timroman
timroman

Reputation: 1394

Stupid error, I had an extra copy of bootstrap in my javascript assets folder. Once I removed that and recompiled the assets, everything worked as expected. No need for jQuery or bootstrap files in your assets, just include the gems and the lines above in application.js, bootstrap after jQuery though.

Upvotes: 1

Related Questions