When I create a new engine in Rails 3.1 stable and then access the dummy
app or the engine I get an error say that the app can't find jquery.
I've created the engine using
rails plugin new coffee --mountable
I've also created a basic controller in the engine and the dummy app. If
I remove the javascript include tag, everything works. But with the tag
there it just bails since it can't fine jQuery. The jquery-rails gem is
installed. I have jquery as a dependency in my
gemspec file. I've even added an Gemfile to the dummy app just to try,
but it gives the same error.
This will this be faster for your users (because Google has more
cloudspace than you, probably) and it also removes the need for
Sprockets to compress it.
Thanks for your answer. I was thinking the same thing and I'll just
start developing without javascript all together since I don't need it
in the initial phase.
I've also tried using and creating the engine with Rails 3.1.0rc5 and
3.1.0rc8 and I get the same error. Surely I can't be alone with geting
this error?
I thought I would post here very quickly because I was having the same
problem and utilizing the google cloud resolved the issue. Here is what
it looks like now.
// This is a manifest file that'll be compiled into including all the
files listed below.
// Add new JavaScript/Coffee code in separate files in this directory
and they'll automatically
// be included in the compiled file accessible from
http://example.com/assets/application.js
// It's not advisable to add code directly here, but if you do, it'll
appear at the bottom of the
// the compiled file.
//
//= javascript_include_tag
'//ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js', :defer
=> true, :async => true
//= require jquery_ujs
//= require_tree .
I had the same problem and finally fixed.
The solution is to explicitly require the 'jquery-rails' gem in the
dummy config/application.rb file, so Sprockets can add the jquery
assets in the assets.path.
In test/dummy/config/application.rb
require File.expand_path('../boot', __FILE__)
# Pick the frameworks you want:
# require "active_record/railtie"
require "action_controller/railtie"
require "action_mailer/railtie"
require "active_resource/railtie"
require "rails/test_unit/railtie"
require "sprockets/railtie"
# Auto-require default libraries and those for the current Rails
environment.
Bundler.require :default, Rails.env
require "coffee"
require "jquery-rails" # this should be auto-included with the
Bundler.require :default, Rails.env, but it's not happening
module Dummy
class Application < Rails::Application
# ...
end
end
Same with other gems that have assets that should be auto-loaded by
Sprockets.
Hope this helps.