Search code examples
ruby-on-railsruby-on-rails-4rails-api

Naming a model asset in Rails conflicts with pipeline


I'm building out an API with Rails that has a few pages I may want to serve up for admin purposes. One of the models I am serving up is called an asset because that's what it is.

The problem is that the routes all show properly when using rake routes and when getting assets from the API it's fine, but when I try to PUT to update the asset it fails with method not allowed. I tried switching the name and Rails is just fine with anything else.

How can I get around this issue without renaming my model or using an alias route?


Solution

  • you can change rails assets path by providing prefix value in configuration like

    config.assets.prefix = "/some_other_path" 
    

    Read more about it here