Rails 4 image-path, image-url and asset-url no longer work in SCSS files

I just had this issue myself. 3 points that will hopefully help: If you place images in your app/assets/images directory, then you should be able to call the image directly with no prefix in the path. ie. image_url(‘logo.png’) Depending on where you use the asset will depend on the method. If you are using it … Read more

No route matches [GET] /assets

In production mode, Rails will not be responsible for serving static assets. Therefore, you are getting this error. Thin won’t do it either, since it’s just a wrapper around Rails. This is controlled by this setting in config/environments/production.rb in your application: config.serve_static_files = false Or in Rails 5: # config/environments/production.rb config.public_file_server.enabled = true Or set … Read more

Using Rails 3.1 assets pipeline to conditionally use certain css

I’ve discovered a way to make it less rigid and future proof by still using the asset pipeline but having the stylesheets grouped. It’s not much simpler than your solution, but this solution allows you to automatically add new stylesheets without having to re-edit the whole structure again. What you want to do is use … Read more

Failed to decode downloaded font, OTS parsing error: invalid version tag + rails 4

I got the exact same error, and in my case it turned out to be because of a wrong path for the @font-face declaration. The web inspector never complained with a 404 since the dev server we’re using (live-server) was configured to serve up the default index.html on any 404:s. Without knowing any details about … Read more

rails 3.1.0 ActionView::Template::Error (application.css isn’t precompiled)

By default Rails assumes that you have your files precompiled in the production environment, if you want use live compiling (compile your assets during runtime) in production you must set the config.assets.compile to true. # config/environments/production.rb … config.assets.compile = true … You can use this option to fallback to Sprockets when you are using precompiled … Read more

Using fonts with Rails asset pipeline

If your Rails version is between > 3.1.0 and < 4, place your fonts in any of the these folders: app/assets/fonts lib/assets/fonts vendor/assets/fonts For Rails versions > 4, you must place your fonts in the app/assets/fonts folder. Note: To place fonts outside of these designated folders, use the following configuration: config.assets.precompile << /\.(?:svg|eot|woff|ttf)\z/ For Rails … Read more

How can I disable logging of asset pipeline (sprockets) messages in Ruby on Rails 3.1?

Place the following code in config/initializers/quiet_assets.rb if Rails.env.development? Rails.application.assets.try(:logger=, Logger.new(‘/dev/null’)) Rails::Rack::Logger.class_eval do def call_with_quiet_assets(env) previous_level = Rails.logger.level Rails.logger.level = Logger::ERROR if env[‘PATH_INFO’] =~ %r{^/assets/} call_without_quiet_assets(env) ensure Rails.logger.level = previous_level end alias_method_chain :call, :quiet_assets end end Updated: It now works for Ruby on Rails 3.2 too (previous attempt fixes before_dispatch, and now we’re going for the … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)