我正在尝试测试一个示例Rails应用程序使用select2 gem。我已经安装gem以下select2-rails。
但是,不幸的是,我得到以下错误:
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 is:
//= require jquery
//= require jquery_ujs
//= require select2
//= require_tree .
application.css is:
*= require_self
*= require_tree .
*= require select2
我遇到了同样的问题。重新启动服务器解决问题