Ruby on Rails: Получена ошибка для файла application.js, Sprockets :: FileNotFound в Home # index - PullRequest
2 голосов
/ 04 декабря 2011

http://0.0.0.0:3000/

Sprockets::FileNotFound in Home#index

Showing /home/user1/rorblog/app/views/layouts/application.html.erb where line #6 raised:

couldn't find file 'jquery'
  (in /home/user1/rorblog/app/assets/javascripts/application.js:7)

Extracted source (around line #6):

3: <head>
4:   <title>Rorblog</title>
5:   <%= stylesheet_link_tag    "application" %>
6:   <%= javascript_include_tag "application" %>
7:   <%= csrf_meta_tags %>
8: </head>
9: <body>

Но похоже, что все файлы есть.

application.html.erb =>

<!DOCTYPE html>
<html>
<head>
  <title>Rorblog</title>
  <%= stylesheet_link_tag    "application" %>
  <%= javascript_include_tag "application" %>
  <%= csrf_meta_tags %>
</head>
<body>
<div id="container">

    <div id="header">

        <ul class="hmenu">
            <li>
                <%= link_to('Home', home_index_path ) %>
            </li>
            <% if user_signed_in? %>
              <li>
                <%= link_to('Logout', destroy_user_session_path, :method => :delete) %>
              </li>

              <li>
                <%= link_to('Edit registration', edit_user_registration_path) %>
              </li>

            <% else %>
              <li>
                <%= link_to('Login', new_user_session_path)  %>
              </li>
            <% end %>
        </ul>
        <p class="notice"><%= notice %></p>
        <p class="alert"><%= alert %></p>       
    </div>

    <div id="content">
        <div id="loadwhat">
            <%= yield %>
        </div>
    </div>

    <div id="footer">
        <%= "user1@copyright.com" %>
    </div>
</div>

</body>
</html>

Gemfile =>

source 'http://rubygems.org'

#gem 'rails', '3.1.1'
gem 'rails'

# Bundle edge Rails instead:
# gem 'rails',     :git => 'git://github.com/rails/rails.git'

gem 'pg'
gem 'devise'
#gem 'rack', '1.3.3'
gem 'will_paginate'

gem 'sqlite3'


# Gems used only for assets and not required
# in production environments by default.
#group :assets do
#  gem 'sass-rails',   '~> 3.1.4'
#  gem 'coffee-rails', '~> 3.1.1'
#  gem 'uglifier', '>= 1.0.3'
#end

#gem 'jquery-rails'

# To use ActiveModel has_secure_password
# gem 'bcrypt-ruby', '~> 3.0.0'

# Use unicorn as the web server
# gem 'unicorn'

# Deploy with Capistrano
# gem 'capistrano'

# To use debugger
# gem 'ruby-debug19', :require => 'ruby-debug'

group :test do
  # Pretty printed test output
  gem 'turn', :require => false
end

1 Ответ

6 голосов
/ 04 декабря 2011

Раскомментируйте эту строку в вашем gemfile:

#gem 'jquery-rails'
...