asset_path in scss file rails - ruby-on-rails

I am having issues with asset_path in production. Rails 3.1.1
#config/environments/development.rb
Scc::Application.configure do
# Settings specified here will take precedence over those in config/application.rb
# In the development environment your application's code is reloaded on
# every request. This slows down response time but is perfect for development
# since you don't have to restart the web server when you make code changes.
config.cache_classes = false
# Log error messages when you accidentally call methods on nil.
config.whiny_nils = true
# Show full error reports and disable caching
config.consider_all_requests_local = true
config.action_controller.perform_caching = false
# Don't care if the mailer can't send
config.action_mailer.raise_delivery_errors = false
# Print deprecation notices to the Rails logger
config.active_support.deprecation = :log
config.action_mailer.default_url_options = { :host => 'localhost:3000' }
# Only use best-standards-support built into browsers
config.action_dispatch.best_standards_support = :builtin
# Do not compress assets
config.assets.compress = false
# Expands the lines which load the assets
config.assets.debug = true
end
and
#config/environments/production.rb
Scc::Application.configure do
# Settings specified here will take precedence over those in config/application.rb
# Code is not reloaded between requests
config.cache_classes = true
# Full error reports are disabled and caching is turned on
config.consider_all_requests_local = false
config.action_controller.perform_caching = true
# Disable Rails's static asset server (Apache or nginx will already do this)
config.serve_static_assets = false
# Compress JavaScripts and CSS
config.assets.compress = true
# Don't fallback to assets pipeline if a precompiled asset is missed
config.assets.compile = false
# Generate digests for assets URLs
config.assets.digest = true
# Defaults to Rails.root.join("public/assets")
# config.assets.manifest = YOUR_PATH
# Specifies the header that your server uses for sending files
# config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
# config.force_ssl = true
# See everything in the log (default is :info)
# config.log_level = :debug
# Use a different logger for distributed setups
# config.logger = SyslogLogger.new
# Use a different cache store in production
# config.cache_store = :mem_cache_store
# Enable serving of images, stylesheets, and JavaScripts from an asset server
# config.action_controller.asset_host = "http://assets.example.com"
# Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added)
# config.assets.precompile += %w( search.js )
# Disable delivery errors, bad email addresses will be ignored
# config.action_mailer.raise_delivery_errors = false
# Enable threaded mode
# config.threadsafe!
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
# the I18n.default_locale when a translation can not be found)
config.i18n.fallbacks = true
# Send deprecation notices to registered listeners
config.active_support.deprecation = :notify
end
I have the following code:
.right-bar-filler{
background:url(asset_path('right_bar_filler.jpg', image)) repeat-y;
padding-top:0px;
}
In development it ends up being:
.right-bar-filler {
background: url("/assets/right_bar_filler.jpg") repeat-y;
padding-top: 0px;
}
In production it outputs as:
.right-bar-filler {
background: url(asset_path("right_bar_filler.jpg", image)) repeat-y;
padding-top: 0px;
}
What am I completely missing?
Thank you for any help.

This doesn't look correct:
.right-bar-filler{
background:url(asset_path('right_bar_filler.jpg', image)) repeat-y;
padding-top:0px;
}
If you want to use the asset_path helper, it needs to run inside the erb tags (<% %>)
.right-bar-filler{
background:url(<%= asset_path('right_bar_filler.jpg', image) %>) repeat-y;
padding-top:0px;
}
and make sure you name the file correctly, i.e. example_filename.css.erb
UPDATE: Sorry, I didn't notice you were using SASS, not CSS. My above answer is not what you need.
Try this instead:
.right-bar-filler{
background:url(asset-path('right_bar_filler.jpg', image)) repeat-y;
padding-top:0px;
}
I.e. I think the asset path helper uses hyphens in SASS, not underscores
http://rubydoc.info/github/petebrowne/sprockets-sass/master/Sprockets/Sass/Functions

Did you rake assets:precompile?
By default, Rails will not compile assets in production. The recommended workflow is to compile assets as part of your deployment.

Related

Digest not generated after compiling assets

After executing rake assets:precompile in production environment it show a message saying
Generated non-digest assets in 485ms
I also tried rake assets:precompile:all, rake assets:precompile:primary but still it isn't generating digest for assets. Here's my production.rb file.
Gullak2::Application.configure do
# Settings specified here will take precedence over those in config/application.rb
# Code is not reloaded between requests
config.cache_classes = true
# Full error reports are disabled and caching is turned on
config.consider_all_requests_local = false
config.action_controller.perform_caching = true
# Disable Rails's static asset server (Apache or nginx will already do this)
config.serve_static_assets = false
# Compress JavaScripts and CSS
config.assets.compress = true
# Don't fallback to assets pipeline if a precompiled asset is missed
config.assets.compile = true
# Generate digests for assets URLs
config.assets.digest = true
config.assets.logger = Logger.new($stdout)
# Defaults to nil and saved in location specified by config.assets.prefix
# config.assets.manifest = YOUR_PATH
# Specifies the header that your server uses for sending files
config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
# config.force_ssl = true
# See everything in the log (default is :info)
# config.log_level = :debug
# Prepend all log lines with the following tags
# config.log_tags = [ :subdomain, :uuid ]
# Use a different logger for distributed setups
# config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
# Use a different cache store in production
# config.cache_store = :mem_cache_store
# Enable serving of images, stylesheets, and JavaScripts from an asset server
# config.action_controller.asset_host = "http://assets.example.com"
# Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added)
config.assets.precompile += %w( merchant.css merchant.js)
config.assets.initialize_on_precompile = false
# Disable delivery errors, bad email addresses will be ignored
# config.action_mailer.raise_delivery_errors = false
# Enable threaded mode
# config.threadsafe!
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
# the I18n.default_locale when a translation can not be found)
config.i18n.fallbacks = true
# Send deprecation notices to registered listeners
config.active_support.deprecation = :notify
end
Try the following code out :-
task non_digested: :environment do
assets = Dir.glob(File.join(Rails.root, 'public/assets/**/*'))
regex = /(-{1}[a-z0-9]{32}*\.{1}){1}/
assets.each do |file|
next if File.directory?(file) || file !~ regex
source = file.split('/')
source.push(source.pop.gsub(regex, '.'))
non_digested = File.join(source)
FileUtils.cp(file, non_digested)
end
end
It was my fault. I didn't look through the log generated by rake assets:precompile RAILS_ENV=production command. It generates assets twice. First it generates assets with digest and after that it generates the non-digested assets.
I was reading only the last message which said Generated non-digest assets

Precompiling my assets is loading all my assets twice in production mode

my team and i have been trying to figure this one out for weeks to no avail. Every time we precompile our assets on our production server, our application will begin to load all of our assets twice (once as a precompiled script, and then again as each asset individually). This problem usually occurs between 2-5 days after the precompile (in other words, it works for a few days before breaking). I'm really not certain why this is happening.
I have seen a lot of other people with the same issue, but their issues are always pertaining to the development environment. However, our application's environment is in production.
here is our method for precompiling:
rake assets:clean
rake assets:precompile
here is my /config/environment.rb:
# Load the rails application
require File.expand_path('../application', __FILE__)
ENV['RAILS_ENV'] ||= 'production'
# Initialize the rails application
Myapp::Application.initialize!
here is my /config/environments/production.rb:
Myapp::Application.configure do
# Settings specified here will take precedence over those in config/application.rb
# Code is not reloaded between requests
config.cache_classes = false
# Full error reports are disabled and caching is turned on
config.consider_all_requests_local = false
config.action_controller.perform_caching = true
# Disable Rails's static asset server (Apache or nginx will already do this)
config.serve_static_assets = false
# Compress JavaScripts and CSS
config.assets.compress = true
# Don't fallback to assets pipeline if a precompiled asset is missed
config.assets.compile = true
# Generate digests for assets URLs
config.assets.digest = true
# BEGIN ICONIC PRECOMPILE ISSUE FIX
# add iconic path to precompile
config.assets.paths << Rails.root.join('app', 'assets', 'fonts')
# Precompile additional assets
config.assets.precompile += %w( .svg .eot .woff .ttf )
# END ICONIC PRECOMPILE ISSUE FIX
# Defaults to nil and saved in location specified by config.assets.prefix
# config.assets.manifest = YOUR_PATH
# Specifies the header that your server uses for sending files
# config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
# config.force_ssl = true
# See everything in the log (default is :info)
config.log_level = :debug
# Prepend all log lines with the following tags
# config.log_tags = [ :subdomain, :uuid ]
# Use a different logger for distributed setups
# config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
# Use a different cache store in production
# config.cache_store = :mem_cache_store
# Enable serving of images, stylesheets, and JavaScripts from an asset server
# config.action_controller.asset_host = "http://assets.example.com"
# Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added)
# config.assets.precompile += %w( search.js )
# Disable delivery errors, bad email addresses will be ignored
# config.action_mailer.raise_delivery_errors = false
# Enable threaded mode
# config.threadsafe!
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
# the I18n.default_locale when a translation can not be found)
config.i18n.fallbacks = true
# Send deprecation notices to registered listeners
config.active_support.deprecation = :notify
# Log the query plan for queries taking more than this (works
# with SQLite, MySQL, and PostgreSQL)
# config.active_record.auto_explain_threshold_in_seconds = 0.5
end
and, although i don't see why you would need it, here is my /config/environments/development.rb:
Myapp::Application.configure do
# Settings specified here will take precedence over those in config/application.rb
# In the development environment your application's code is reloaded on
# every request. This slows down response time but is perfect for development
# since you don't have to restart the web server when you make code changes.
config.cache_classes = false
# Log error messages when you accidentally call methods on nil.
config.whiny_nils = true
# Show full error reports and disable caching
config.consider_all_requests_local = true
config.action_controller.perform_caching = false
# Don't care if the mailer can't send
config.action_mailer.raise_delivery_errors = false
# Print deprecation notices to the Rails logger
config.active_support.deprecation = :log
# Only use best-standards-support built into browsers
config.action_dispatch.best_standards_support = :builtin
# Raise exception on mass assignment protection for Active Record models
config.active_record.mass_assignment_sanitizer = :strict
# Log the query plan for queries taking more than this (works
# with SQLite, MySQL, and PostgreSQL)
config.active_record.auto_explain_threshold_in_seconds = 0.5
# Do not compress assets
config.assets.compress = false
# Expands the lines which load the assets
config.assets.debug = true
end
***UPDATE*
as per the suggested answer, I have modified my environments/production.rb. it now looks like this:
Myapp::Application.configure do
# Settings specified here will take precedence over those in config/application.rb
# Code is not reloaded between requests
config.cache_classes = false
# Full error reports are disabled and caching is turned on
config.consider_all_requests_local = true
config.action_controller.perform_caching = false
# Disable Rails's static asset server (Apache or nginx will already do this)
config.serve_static_assets = true
# config.assets.debug = false
# Compress JavaScripts and CSS
config.assets.compress = true
# Don't fallback to assets pipeline if a precompiled asset is missed
config.assets.compile = true
# Generate digests for assets URLs
config.assets.digest = true
# BEGIN ICONIC PRECOMPILE ISSUE FIX
# add iconic path to precompile
# config.assets.paths << Rails.root.join('app', 'assets', 'fonts')
# Precompile additional assets
# config.assets.precompile += %w( .svg .eot .woff .ttf )
# END ICONIC PRECOMPILE ISSUE FIX
# Defaults to nil and saved in location specified by config.assets.prefix
# config.assets.manifest = YOUR_PATH
# Specifies the header that your server uses for sending files
# config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
# config.force_ssl = true
# See everything in the log (default is :info)
config.log_level = :debug
# Prepend all log lines with the following tags
# config.log_tags = [ :subdomain, :uuid ]
# Use a different logger for distributed setups
# config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
# Use a different cache store in production
# config.cache_store = :mem_cache_store
# Enable serving of images, stylesheets, and JavaScripts from an asset server
# config.action_controller.asset_host = "http://assets.example.com"
# Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added)
# config.assets.precompile += %w( search.js )
# Disable delivery errors, bad email addresses will be ignored
# config.action_mailer.raise_delivery_errors = false
# Enable threaded mode
# config.threadsafe!
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
# the I18n.default_locale when a translation can not be found)
config.i18n.fallbacks = true
# Send deprecation notices to registered listeners
config.active_support.deprecation = :notify
# Log the query plan for queries taking more than this (works
# with SQLite, MySQL, and PostgreSQL)
# config.active_record.auto_explain_threshold_in_seconds = 0.5
end
instead of fixing my problem, all of my assets are now loading twice immediately after precompiling. I'm not sure what I'm doing wrong here.
here are the commands i'm running:
rm -rf public/assets
rake assets:clean
rake assets:precompile
any insight would be greatly appreciated. thanks!
Maybe disabling the live compilation of assets on production could fix your issue.
In your config/environments/production.rb set:
config.assets.compile = false
Take a quick look at this question. It may clarify the "after a few days" part of the issue.
GL & HF
You say that all of your assets are being loaded once from application.css / application.js and then again from their individual files. From what you said, it sounds like you have a bunch of <script> and <style> tags in your <head> element - is that true? That should only happen when you have config.assets.debug = true. In production, the individual files should not appear there at all. You should only have application.css and application.js.
This makes me think that something about your production configuration is wrong or that the wrong environment configuration is being used on your server.
(It could also happen if you added links to the individual files in your layout. Are you doing that?)
It would be easier to debug if you provided the <head> element of your document + the head section of your application layout (or whatever layout you're using).
A few thoughts:
Is your server setting RAILS_ENV=production?
When you compile your assets on your production machine, are you setting RAILS_ENV=production for the rake task?
Is your clock correct on your production machine?
Are your assets really being loaded twice, or are you just seeing JS callbacks fire multiple times? If you're using Turbolinks, any JS in the body of your document that attaches on-document-ready callbacks will begin firing multiple times once you have clicked on any turbolinks-enabled link (but not after a fresh load).
You still have "config.assets.compile = true" in your updated config. You shouldn't need that if you're precompiling assets, and it can cover up problems, so I would suggest changing it back to false.
Here is the assets config I'm using for production apps:
# Disable Rails's static asset server (Apache or nginx will already do this)
config.serve_static_assets = false
# Compress JavaScripts and CSS
config.assets.compress = true
# Don't fallback to assets pipeline if a precompiled asset is missed
config.assets.compile = false
# Generate digests for assets URLs
config.assets.digest = true
Please try with that config and keep us updated.

Rails + AWS + sendmail: Emails not being sent even with (seemingly) correct config settings?

So in my development my emails are sending fine when I change the settings. However in my preview environment on my server, in the logs it looks like emails are sending properly with no errors, but I never receive anything. This applies to not just one mailer, but all of them.
This is my config/environments/preview.rb file:
EdmundWeb::Application.configure do
# Settings specified here will take precedence over those in config/application.rb
# Code is not reloaded between requests
config.cache_classes = true
# Full error reports are disabled and caching is turned on
config.consider_all_requests_local = false
config.action_controller.perform_caching = true
config.action_mailer.raise_delivery_errors = true
config.action_mailer.perform_deliveries = true
# Disable Rails's static asset server (Apache or nginx will already do this)
config.serve_static_assets = false
# Compress JavaScripts and CSS
config.assets.compress = true
# Don't fallback to assets pipeline if a precompiled asset is missed
config.assets.compile = false
# Generate digests for assets URLs
config.assets.digest = true
# Defaults to nil and saved in location specified by config.assets.prefix
# config.assets.manifest = YOUR_PATH
# Specifies the header that your server uses for sending files
# config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
# config.force_ssl = true
# See everything in the log (default is :info)
config.log_level = :debug
# Prepend all log lines with the following tags
# config.log_tags = [ :subdomain, :uuid ]
# Use a different logger for distributed setups
# config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
# Use a different cache store in production
# config.cache_store = :mem_cache_store
config.action_view.cache_template_loading = true
config.cache_store = :dalli_store, 'localhost', { :namespace => 'preview' }
# Enable serving of images, stylesheets, and JavaScripts from an asset server
# config.action_controller.asset_host = "http://assets.example.com"
# Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added)
# config.assets.precompile += %w( search.js )
# Enable threaded mode
# config.threadsafe!
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
# the I18n.default_locale when a translation can not be found)
config.i18n.fallbacks = true
# Send deprecation notices to registered listeners
config.active_support.deprecation = :notify
# Log the query plan for queries taking more than this (works
# with SQLite, MySQL, and PostgreSQL)
# config.active_record.auto_explain_threshold_in_seconds = 0.5
# For Devise
config.action_mailer.default_url_options = { :host => 'mysite.com' }
config.to_prepare { Devise::SessionsController.force_ssl }
config.to_prepare { Devise::RegistrationsController.force_ssl }
config.to_prepare { Devise::PasswordsController.force_ssl }
end
In my environment.rb I set my mailer to sendmail:
# Load the rails application
require File.expand_path('../application', __FILE__)
# Initialize the rails application
EdmundWeb::Application.initialize!
ActionMailer::Base.delivery_method = :sendmail
Could it be mailer settings on my AWS server that is preventing my mailer from sending mail?
My AWS machine was running on ubuntu. The fix was running apt-get install postfix as root and accepting all the default answers. How is this not documented anywhere else!

Rails loads css files from public/assets instead of app/assets in development mode

I'm running in development mode. I'm editing .css files but not seeing changes. If I go to public/assets/ and rename application.css, I see changes (it can't find any styles). Why would it be using that file? Isn't that for production mode? I don't want to pre-compile all the time in dev mode. thanks. Environment files added below.
development.rb :
Tcms::Application.configure do
# Settings specified here will take precedence over those in config/application.rb
# In the development environment your application's code is reloaded on
# every request. This slows down response time but is perfect for development
# since you don't have to restart the web server when you make code changes.
config.cache_classes = false
# Log error messages when you accidentally call methods on nil.
config.whiny_nils = true
# Show full error reports and disable caching
config.consider_all_requests_local = true
config.action_controller.perform_caching = false
# Don't care if the mailer can't send
config.action_mailer.raise_delivery_errors = false
# Print deprecation notices to the Rails logger
config.active_support.deprecation = :log
# Only use best-standards-support built into browsers
config.action_dispatch.best_standards_support = :builtin
# Raise exception on mass assignment protection for Active Record models
config.active_record.mass_assignment_sanitizer = :strict
# Log the query plan for queries taking more than this (works
# with SQLite, MySQL, and PostgreSQL)
config.active_record.auto_explain_threshold_in_seconds = 0.5
# Do not compress assets
config.assets.compress = false
# Expands the lines which load the assets
config.assets.debug = true
end
production.rb :
Tcms::Application.configure do
# Uncomment and set this to match your production URL. Used for emailing links to the CMS. (default: localhost:3000)
# config.cms.site_domain = "www.example.com"
# Configure your mail server's address below
config.action_mailer.smtp_settings = {:address => 'mail.yourmailserver.com', :domain => config.cms.site_domain}
# Settings specified here will take precedence over those in config/application.rb
# Code is not reloaded between requests
config.cache_classes = true
# Full error reports are disabled and caching is turned on
config.consider_all_requests_local = false
config.action_controller.perform_caching = true
# Disable Rails's static asset server (Apache or nginx will already do this)
config.serve_static_assets = true
# Compress JavaScripts and CSS
config.assets.compress = true
# Don't fallback to assets pipeline if a precompiled asset is missed
config.assets.compile = true
# Generate digests for assets URLs
config.assets.digest = true
# Defaults to nil and saved in location specified by config.assets.prefix
# config.assets.manifest = YOUR_PATH
# Specifies the header that your server uses for sending files
# config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
# config.force_ssl = true
# See everything in the log (default is :info)
config.log_level = :info
# Prepend all log lines with the following tags
# config.log_tags = [ :subdomain, :uuid ]
# Use a different logger for distributed setups
# config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
# Use a different cache store in production
# config.cache_store = :mem_cache_store
# Enable serving of images, stylesheets, and JavaScripts from an asset server
# config.action_controller.asset_host = "http://assets.example.com"
# Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added)
# config.assets.precompile += %w( search.js )
# Disable delivery errors, bad email addresses will be ignored
# config.action_mailer.raise_delivery_errors = false
# Enable threaded mode
# config.threadsafe!
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
# the I18n.default_locale when a translation can not be found)
config.i18n.fallbacks = true
# Send deprecation notices to registered listeners
config.active_support.deprecation = :notify
# Log the query plan for queries taking more than this (works
# with SQLite, MySQL, and PostgreSQL)
# config.active_record.auto_explain_threshold_in_seconds = 0.5
end
As default, Rails will serve assets within /public and not compiling live, if these assets exists.
To get rid of it, either delete the assets within the public dir,
or add the following line into you config/environments/development.rb
config.serve_static_assets = false
config.serve_static_assets configures Rails itself to serve static
assets. Defaults to true
More to read: here
What version of rails are you running? Is this an app that upgraded from 2.x or 3.0.x to 3.1 or 3.2? This almost sounds like this app was pre-asset pipline. Here is a good tutorial on upgrading from pre-asset pipline to asset-pipline...
http://railscasts.com/episodes/282-upgrading-to-rails-3-1
...also here is a good basic tutorial for asset pipeline...
http://railscasts.com/episodes/279-understanding-the-asset-pipeline

Datatables not showing in production mode after running rake assets:precompile. rails 3.2

When i run my application in development my datatables table is showing
but when i run my app in production datatables is not showing. only the records ar shown.
screenshot in developemnt:
screenshot in production:
My production.rb:
Contractbeheerpj::Application.configure do
# Settings specified here will take precedence over those in config/application.rb
# Code is not reloaded between requests
config.cache_classes = true
# Full error reports are disabled and caching is turned on
config.consider_all_requests_local = false
config.action_controller.perform_caching = true
# Disable Rails's static asset server (Apache or nginx will already do this)
config.serve_static_assets = false
# Compress JavaScripts and CSS
config.assets.compress = true
# Don't fallback to assets pipeline if a precompiled asset is missed
config.assets.compile = true
# Generate digests for assets URLs
config.assets.digest = true
# Defaults to nil and saved in location specified by config.assets.prefix
# config.assets.manifest = YOUR_PATH
# Specifies the header that your server uses for sending files
# config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
# config.force_ssl = true
# See everything in the log (default is :info)
# config.log_level = :debug
# Prepend all log lines with the following tags
# config.log_tags = [ :subdomain, :uuid ]
# Use a different logger for distributed setups
# config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
# Use a different cache store in production
# config.cache_store = :mem_cache_store
# Enable serving of images, stylesheets, and JavaScripts from an asset server
# config.action_controller.asset_host = "http://assets.example.com"
# Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added)
# config.assets.precompile += %w( search.js )
# Disable delivery errors, bad email addresses will be ignored
# config.action_mailer.raise_delivery_errors = false
# Enable threaded mode
# config.threadsafe!
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
# the I18n.default_locale when a translation can not be found)
config.i18n.fallbacks = true
# Send deprecation notices to registered listeners
config.active_support.deprecation = :notify
# Log the query plan for queries taking more than this (works
# with SQLite, MySQL, and PostgreSQL)
# config.active_record.auto_explain_threshold_in_seconds = 0.5
end
Hope someone can help! :)
Your issue is probably because of Rails Asset pipelining which Rails in production precompiles your js files to public/assets hence your js file is either not loaded or is an older version. Look at this answer to a similar issue to what you are having.

Resources