25

Standard new rails app has issue showing the rails.png

ActionController::RoutingError (No route matches [GET] "/assets/rails.png"):

I have tried moving the .png file around to various places in assets and assets/images and also the older place 'public' or 'public/images' and changing the page but nothing has helped. Please answer if you have seen and resolved this. I have tried about 20 different combo's myself.

Version: 'rails', '3.1.0.rc4'

Michael Durrant
  • 93,410
  • 97
  • 333
  • 497
  • 1
    looks like here is `/assets/` dir permissions problem – fl00r Aug 18 '11 at 11:41
  • sure but I've never seen this in other new apps on this machine for other rails versions. I am hoping to find someone who has experienced/resolved this. – Michael Durrant Aug 18 '11 at 12:10
  • Yes it is permissions and chmod 777 images/rails.png resolves this but doesn't really address the issue. I haven't had to do this before with other rails applications and I am pretty nervous about doing that for this image if it will mean similar issue for other assets. – Michael Durrant Aug 18 '11 at 12:13
  • possible duplicate of [No route matches \[GET\] "/assets](http://stackoverflow.com/questions/7829480/no-route-matches-get-assets) – Marc-André Lafortune Aug 04 '12 at 15:19

2 Answers2

31

I just had a problem throwing a similar error. In my case I was starting the rails server in production mode in Mac OSX using the standard WEBrick. It threw this error because of the line:

config.serve_static_assets = false

in config/environments/production.rb.

That is set because on most production machines the web server itself will handle this.

It looks like you were having a different problem, but I'll post this here for others that run into this error.

tybro0103
  • 48,327
  • 33
  • 144
  • 170
  • 1
    this did the fix for me - after searching all over the net, this made me realize how to make it work with webrick. I strongly upvote this. – David Dec 21 '11 at 15:47
  • 1
    Glad to help :) Shame to see some joker downvote... I'm sure many people will find this useful. – tybro0103 Dec 21 '11 at 16:12
  • 1
    it also worked for me. now I'm wondering how could I run locally a production environment without have to change this config, because in my production machine it must be 'false'. any ideas? – seixasfelipe Feb 22 '13 at 15:15
  • 1
    @seixasfelipe yes - create a new environment that's identical to production except for that line – tybro0103 Nov 11 '13 at 16:35
9

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!

Michael Durrant
  • 93,410
  • 97
  • 333
  • 497
  • Thanks for pointing this out, guess a few people following the RoR 3.0 tutorial will have the same problem when reaching Section 4.1.2 ;-) – cvk Feb 08 '12 at 18:49