使用带有Rails 3.2.8的select2 gem时的Sprockets :: FileNotFound

时间:2013-04-15 17:19:19

标签: ruby-on-rails-3 jquery-select2 sprockets select2-rails

我正在尝试测试示例Rails应用以使用select2 gem。我在select2-rails之后安装了gem。

但是,不幸的是我收到了以下错误:

Sprockets::FileNotFound in Home#index

Showing /Users/Rakib/Desktop/Development/TEST_PROJECTS/selecttest/app/views/layouts/application.html.erb where line #5 raised:

couldn't find file 'select2'
  (in /Users/Rakib/Desktop/Development/TEST_PROJECTS/selecttest/app/assets/stylesheets/application.css:14)
Extracted source (around line #5):

2: <html>
3: <head>
4:   <title>Selecttest</title>
5:   <%= stylesheet_link_tag    "application", :media => "all" %>
6:   <%= javascript_include_tag "application" %>
7:   <%= csrf_meta_tags %>
8: </head>
Rails.root: /Users/Rakib/Desktop/Development/TEST_PROJECTS/selecttest

我的Gemfile是:

source 'https://rubygems.org'

gem 'rails', '3.2.8'
gem 'sqlite3'

group :assets do
  gem 'sass-rails',   '~> 3.2.3'
  gem 'coffee-rails', '~> 3.2.1'
  gem 'uglifier', '>= 1.0.3'
end

gem 'jquery-rails'
gem 'jquery-rails'
gem "select2-rails"

application.js 是:

//= require jquery
//= require jquery_ujs
//= require select2
//= require_tree .

application.css 是:

 *= require_self
 *= require_tree .
 *= require select2

我在这里缺少什么?

1 个答案:

答案 0 :(得分:13)

我遇到了同样的问题。通过重新启动服务器解决了问题。