The Rails pipeline is throughly confusing to newcomers to Rails. My team has taken over the maintence of a rather complex beast that controls our authentication for multiple products. Some use OAuth, some use and SSO cookie we generate. We also use Omni-Auth for social login and password identities.

The pipeline problem

The asset pipeline automatically pulls in application.js and application.css from the assets directory. Anything else, needs to be manually included in config/initializers/assets.js

Rails.application.config.assets.precompile += %w(
  admin.js
  admin.css
  profile.js
  profile.css
)

Then you’ll need a couple settings in your config/environments/production.rb file:

1
2
3
4
5
6
7
8
9
10
11
12
# Disable Rails's static asset server (Apache or nginx will already do this)
config.serve_static_files = false

# Compress JavaScripts and CSS
config.assets.js_compressor = Uglifier.new(harmony: true)
# config.assets.css_compressor = :sass

# 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