The solution for me was to add jquery-rails to my engines Gemfile and
restart the server.

I would suspect that it does not want adding to the gemspec however,
however adding it as a development dependency might be okay.

-- Kris.
On Sep 12, 7:57 pm, tothemario wrote:
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.

- Mario Izquierdo

On Sep 1, 9:02 pm, Jorgen Nilsson wrote:






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.
accessing the dummy app
----------------------------------------------------------
Sprockets::FileNotFound in Root#index
couldn't find file 'jquery'
(in /Webapps/coffee/test/dummy/app/assets/javascripts/application.js:7)
Started GET "/" for 127.0.0.1 at 2011-09-01 20:31:01 +0200
Processing by RootController#index as HTML
Rendered root/index.html.erb within layouts/application (8.9ms)
Completed 500 Internal Server Error in 89ms
ActionView::Template::Error (couldn't find file 'jquery'
(in
/Webapps/coffee/test/dummy/app/assets/javascripts/application.js:7)):
3: <head>
4:   <title>Dummy</title>
5:   <%= stylesheet_link_tag    "application" %>
6:   <%= javascript_include_tag "application" %>
7:   <%= csrf_meta_tags %>
8: </head>
9: <body>
app/views/layouts/application.html.erb:6:in
`_app_views_layouts_application_html_erb___187280571548804820_2155822020'
accessing the engine
----------------------------------------------------------
Sprockets::FileNotFound in Coffee/pages#index
couldn't find file 'jquery'
(in /Webapps/coffee/app/assets/javascripts/coffee/application.js:7)
Started GET "/coffee" for 127.0.0.1 at 2011-09-01 20:49:57 +0200
Processing by Coffee::PagesController#index as HTML
Rendered /Webapps/coffee/app/views/coffee/pages/index.html.erb within
layouts/coffee/application (0.3ms)
Completed 500 Internal Server Error in 41ms
ActionView::Template::Error (couldn't find file 'jquery'
(in
/Users/jorgen/Webapps/coffee/app/assets/javascripts/coffee/application.js:7)):
3: <head>
4:   <title>Coffee</title>
5:   <%= stylesheet_link_tag    "coffee/application" %>
6:   <%= javascript_include_tag "coffee/application" %>
7:   <%= csrf_meta_tags %>
8: </head>
9: <body>
--
Posted viahttp://www.ruby-forum.com/.
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Search Discussions

  • Santiago Pastorino at Sep 21, 2011 at 11:58 pm
    Fixed here https://github.com/rails/rails/commit/007f56701102647088673d92b165c3d862fbba22
    On Sun, Sep 18, 2011 at 1:22 PM, Kris wrote:
    The solution for me was to add jquery-rails to my engines Gemfile and
    restart the server.

    I would suspect that it does not want adding to the gemspec however,
    however adding it as a development dependency might be okay.

    -- Kris.
    On Sep 12, 7:57 pm, tothemario wrote:
    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.

    - Mario Izquierdo

    On Sep 1, 9:02 pm, Jorgen Nilsson wrote:






    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.
    accessing the dummy app
    ----------------------------------------------------------
    Sprockets::FileNotFound in Root#index
    couldn't find file 'jquery'
    (in /Webapps/coffee/test/dummy/app/assets/javascripts/application.js:7)
    Started GET "/" for 127.0.0.1 at 2011-09-01 20:31:01 +0200
    Processing by RootController#index as HTML
    Rendered root/index.html.erb within layouts/application (8.9ms)
    Completed 500 Internal Server Error in 89ms
    ActionView::Template::Error (couldn't find file 'jquery'
    (in
    /Webapps/coffee/test/dummy/app/assets/javascripts/application.js:7)):
    3: <head>
    4:   <title>Dummy</title>
    5:   <%= stylesheet_link_tag    "application" %>
    6:   <%= javascript_include_tag "application" %>
    7:   <%= csrf_meta_tags %>
    8: </head>
    9: <body>
    app/views/layouts/application.html.erb:6:in
    `_app_views_layouts_application_html_erb___187280571548804820_2155822020'
    accessing the engine
    ----------------------------------------------------------
    Sprockets::FileNotFound in Coffee/pages#index
    couldn't find file 'jquery'
    (in /Webapps/coffee/app/assets/javascripts/coffee/application.js:7)
    Started GET "/coffee" for 127.0.0.1 at 2011-09-01 20:49:57 +0200
    Processing by Coffee::PagesController#index as HTML
    Rendered /Webapps/coffee/app/views/coffee/pages/index.html.erb within
    layouts/coffee/application (0.3ms)
    Completed 500 Internal Server Error in 41ms
    ActionView::Template::Error (couldn't find file 'jquery'
    (in
    /Users/jorgen/Webapps/coffee/app/assets/javascripts/coffee/application.js:7)):
    3: <head>
    4:   <title>Coffee</title>
    5:   <%= stylesheet_link_tag    "coffee/application" %>
    6:   <%= javascript_include_tag "coffee/application" %>
    7:   <%= csrf_meta_tags %>
    8: </head>
    9: <body>
    --
    Posted viahttp://www.ruby-forum.com/.
    --
    You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
    --
    You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouprubyonrails-talk @
categoriesrubyonrails
postedSep 19, '11 at 7:22a
activeSep 21, '11 at 11:58p
posts2
users2
websiterubyonrails.org
irc#RubyOnRails

2 users in discussion

Kris: 1 post Santiago Pastorino: 1 post

People

Translate

site design / logo © 2021 Grokbase