我正在使用ZURB Foundation创建一个新的应用程序。有三个控制器。其中之一-一切都很好,所有的css和javascript包括每次当我运行开发中的服务器。但如果我运行我的项目#控制器,它只得到纯html,没有加载javascript和css。我什么都试过了,但还是不知道该怎么办。
下面是控制台的日志:
当它正常工作时
Started GET "/" for 127.0.0.1 at 2013-01-09 21:36:21 +0200
Processing by PagesController#info as HTML
Rendered pages/info.html.erb within layouts/application (0.3ms)
Rendered layouts/_head.html.erb (36.9ms)
User Load (1.6ms) SELECT "users".* FROM "users" WHERE "users"."id" = 1 LIMIT 1
Rendered layouts/_header.html.erb (8.9ms)
Rendered layouts/_flash_messages.html.erb (0.3ms)
Rendered layouts/_footer.html.erb (66.0ms)
Completed 200 OK in 368ms (Views: 365.2ms | ActiveRecord: 1.6ms)
但是如果我从另一个控制器转到另一个页面它只会从页面
加载纯htmlStarted GET "/projects/" for 127.0.0.1 at 2013-01-09 21:23:21 +0200
Processing by ProjectsController#index as HTML
User Load (1.1ms) SELECT "users".* FROM "users" WHERE "users"."id" = 1 LIMIT 1
Project Load (0.5ms) SELECT "projects".* FROM "projects" WHERE "projects"."user_id" = 1 ORDER BY created_at desc
Rendered projects/index.html.erb (30.8ms)
Completed 200 OK in 78ms (Views: 38.4ms | ActiveRecord: 2.7ms)
Gemfile
source 'https://rubygems.org'
gem 'rails', '3.2.11'
group :development, :test do
gem 'sqlite3'
gem 'rspec-rails'
gem 'factory_girl_rails'
end
group :assets do
gem 'sass-rails', '~> 3.2.3'
gem 'coffee-rails', '~> 3.2.1'
gem 'compass-rails'
gem 'zurb-foundation'
gem 'uglifier', '>= 1.0.3'
end
gem 'jquery-rails'
gem 'devise'
gem 'thin'
gem 'best_in_place'
group :test do
gem 'capybara'
gem 'shoulda-matchers'
end
group :production do
gem 'pg'
end
application.html.erb
<!DOCTYPE html>
<html lang="en">
<head>
<%= render 'layouts/head' %>
</head>
<body>
<%= render 'layouts/header' %>
<div class="container-fluid">
<div class="row-fluid">
<div class="span8 offset2">
<%= render 'layouts/flash_messages' %>
<%= yield %>
</div>
</div>
</div>
<div class='row-fluid'>
<%= render 'layouts/footer' %>
</div>
</body>
</html>
和控制器
class PagesController < ApplicationController
respond_to :html
def info
end
end
class ProjectsController < ActionController::Base
# before_filter :authenticate_user!
def index
@projects = current_user.projects
respond_to do |format|
format.html
end
end
end
任何帮助或想法将非常感激!
您需要将class ProjectsController < ActionController::Base
更改为class ProjectsController < ApplicationController
,然后它将知道在哪里搜索布局