【发布时间】:2013-07-19 06:44:08
【问题描述】:
导轨:4.0.0 红宝石:1.9.3
我在我的 Rails 应用程序中使用 jQuery 的 animate() 方法。
我无法让它工作。
我已阅读jquery-ui-rails 的文档并按照那里提到的步骤进行操作,即
- 安装了 gem
- 将其包含在 Gemfile 中 -
gem 'jquery-ui-rails' - 捆绑安装
- 在我的
application.js文件中添加了//= require jquery.ui.all
但我收到了 Sprockets::FileNotFound 错误。
Showing /Users/anil20787/workspace/railsdir/depot/app/views/layouts/application.html.erb where line #9 raised:
couldn't find file 'jquery.ui.all'
(in /Users/anil20787/workspace/railsdir/depot/app/assets/javascripts/application.js:14)
宝石文件
source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.0.0'
# Use sqlite3 as the database for Active Record
gem 'sqlite3'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 4.0.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .js.coffee assets and views
gem 'coffee-rails', '~> 4.0.0'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby
# Use jquery as the JavaScript library
gem 'jquery-rails'
gem 'jquery-ui-rails'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 1.2'
group :doc do
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', require: false
end
我确实也查找了this post,遇到了与我类似的问题,但它指向的是我已经遵循的文档。不知道我在哪里犯了错误。
感谢任何帮助。谢谢
【问题讨论】:
-
你能出示你的 gemfile 吗?
-
只做 rake assets:precompile and see...
-
此命令将一些png文件写入(或复制)到目录/projectDirectory/public/assets/jquery-ui/但错误仍然存在
-
你在添加 gem 后捆绑安装了吗?
-
是的,我做到了。并且输出确实表明正在使用宝石
... Using jquery-rails (3.0.4) Using jquery-ui-rails (4.0.3) ...