rails 3.1 ActionController::RoutingError (No route matches [GET] /assets/rails.png ):
It must have been an rc4 issue as the final release didn't have this issue.
11/27/11 - I now wonder if this was just due to the asset pipeline that was introduced in rails 3.1, requiring the rake assets:precompile
command (compiles and copies images, css and js from app/assets
to public/
.
If anyone finds that to be the case, please add a comment!
no route matches for assets/images in Rails
Actually you cannot reference your image with /assets/home.png
path.
It will work in development mode, but in production all of your assets have a fingerprint in their filename (read this http://guides.rubyonrails.org/asset_pipeline.html#what-is-fingerprinting-and-why-should-i-care-questionmark)
That's why, in assets-pipeline enabled applications you need to reference all of your assets using helper methods. Read this doc to learn about the different helpers available in Ruby, JS and Sass files: http://guides.rubyonrails.org/asset_pipeline.html#coding-links-to-assets
Rails 3.1.3 on Heroku: (No route matches [GET] /assets/rails.png )
It looks like you may not have precompiled your assets before you pushed to Heroku, try:
rake assets:precompile
git add .
etc etc
I think that should help. For more information, see here: http://devcenter.heroku.com/articles/rails31_heroku_cedar
How to solve ' No route matches [GET] image.png ' when I moved image to assets image path?
Everything in subdirectories of assets (regardless whether it is an image, JS, etc.) is by default available under /assets/name.extension
. So just make sure you refer to the image with the path /assets/login_logo.png
, or use the asset_path
helper:
<%= asset_path('login_logo.png') %>
why am i getting this routing error? ActionController::RoutingError (No route matches [GET] /assets/toastr.js.map ):
I came across a similar problem recently. The way I solved it was by going inside the manifest file (e.g., public/assets/.sprockets-manifest-[md5hash].json
, finding the logical names of the asset files and using those instead of the absolute paths.
In my case, the fix was to remove the /assets/
prefix from the javascript_include_tag
.
In particular, in my html files I replaced this...
= javascript_include_tag "/assets/admin/events/index.js"
...with this...
= javascript_include_tag "admin/events/index.js"
...and recompiled assets. This seemed to do the trick for me.
Here's a reference to the thread where I found this solution:
Rails 5 + Heroku: Assets are not loaded in production, but works in localhost
ActionController::RoutingError (No route matches [GET] /assets/javascripts
You need to include these files in application.js manully or just write //= require_tree .
to load all js
Similarly, you have to work for css. Add *= require_tree .
in application.css
.
Related Topics
Rspec Testing Redirect to Url with Get Params
Print All Method Names of a Class in Ruby
Rails: Pg::Insufficientprivilege: Error: Permission Denied for Relation Schema_Migrations
How to Test for a Redirect with Rspec and Capybara
Ruby Does Not 'Ensure' When I 'Retry' in 'Rescue'
What Does Class Classname < ::Otherclassname Do in Ruby
How to Convert a Net::Http Response to a Certain Encoding in Ruby 1.9.1
Count the Length (Number of Lines) of a CSV File
Ruby on Rails - Devise Users/Sign_Out Not Working
How to Find a Devise User by It's Session Id
Displaying Only the First X Words of a String in Rails
How to Use a Branch in a Fork of Rails in a Project with Bundler
How to Access Firefox Extension I Added in Selenium Webdriver
Can't Run Jenkins Build - Bundle: "Command Not Found"
What Is the Activemodel Method Attribute "_Was" Used For