开发者

Why do I get "no route matches" for requests to the asset pipeline?

I'm working on upgrading an app to use Rails 3.1 and I'm trying to use the asset pipeline. As a test, I've added foobar.js to app/assets/javascripts.

The Setup

In application.rb, I've added config.assets.enabled = true. Going on this guide, I think that's all I have to do.

Checking it out

If I load the console and check Rails.application.config.assets.paths, I do see app/assets/javascripts in the load path. Also, if I check MyAppName::Application.assets, I get back a Sprockets::Environment object which has the same paths.

That all looks good to me.

Trying to use it

In a view, I'm using javascript_include_tag('foobar'). That outputs the following HTML: <script src="/javascripts/foobar.js" type="text/javascript"></script>

The error

Following that link gets me an error: No route matches [GET] "/javascripts/foobar.js"

Is there a piece of setup I'm missing?


Misc Details

I'm curre开发者_StackOverflow社区ntly using:

  • ruby-1.9.2-p290
  • rails-3.1.0.rc6
  • sprockets-2.0.0.beta.14 (required by Rails)


I still had to add the files manually to the pipeline (see link).

I guess it's because Rails 3.1 is still in beta

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜