Skip to content Skip to sidebar Skip to footer

Rails 4 - In Production My Javascript Is Loaded But Does Not Work While It Works Well In Development

I work with : Rails version 4.2.3 Ruby version 2.2.1 I have managed to run my application in production doing these steps : rake db:create RAILS_ENV=production rake db:migrate R

Solution 1:

In production mode, it should server by web servers(Apache, Nginx) and will work. until that fix you can load all files in production rather loading a compressed single application.js and application.css file. For that in production.rb file disable the config variable. like below

config.serve_static_assets = false

Solution 2:

The problem lies within your application.js and more specifically I believe where your bootstrap is being called. What fixed it for me was moving bootstrap to the bottom.

Asset pipeline is disabled in dev which is why you did not experience the same issues there.

Post a Comment for "Rails 4 - In Production My Javascript Is Loaded But Does Not Work While It Works Well In Development"