rails: Model named "Asset" cannot accept PATCH or PUT requests

Trying a new 4.2.1 application based on a working 4.1.8 application (entirely rebuilt in 4.2.1 using scaffold, not reusing any 4.1.8 code).

A model named Asset will work for a POST or GET request, but will not accept PATCH or PUT requests (did not test DELETE).

Testing in WEBrick, the browser shows a plain text error message Method Not Allowed. The console reports Started PATCH "/assets/1" for ::1 at 2015-05-02 15:32:49 -0400 and never proceeds beyond that point.

Renaming Asset to Image (which is a misnomer for my application) allows everything to work as expected.

Also tested this on 4.2.0, so this seems to be the point of regression.

About this issue

  • Original URL
  • State: closed
  • Created 9 years ago
  • Comments: 17 (10 by maintainers)

Commits related to this issue

Most upvoted comments

@matthewd @walterdavis On digging more, this was added in Sprockets here - https://github.com/rails/sprockets/commit/62847ac5 which is above Sprockets > 3.0.

You wouldn’t need to dig very far in the issue tracker to see complaints about Actually Reserved words appearing in each release – though we do strive to minimize them.

As far as I know, however, this is about the least reserved you can get: change one config setting, and the problem should go away:

Rails.application.config.assets.prefix = '/the-other-assets'

@prathamesh-sonpatki while you’re there, are you able to confirm it works on 4.1?