0
我學習Ruby和我建立了一個這樣的控制器:爲什麼我缺少模板mobile/home/index,application/index?
class Mobile::HomeController < ApplicationController
def index
end
def create
end
end
這是非常基本的,並增加了這樣的路線:
scope :module => :mobile, :as => :mobile do
constraints(:subdomain => /m/) do
resources :home
end
end
,當我嘗試看到的頁面中瀏覽器中,我得到這個錯誤:
Missing template mobile/home/index, application/index with {:locale=>[:en, :en], :formats=>[:html], :handlers=>[:haml, :erb, :builder]}. Searched in: * "/Users/alexgenadinik/projects/cmply/cmply-app/app/views" * "/Library/Ruby/Gems/1.8/gems/ckeditor-3.6.3/app/views" * "/Library/Ruby/Gems/1.8/gems/kaminari-0.13.0/app/views" * "/Library/Ruby/Gems/1.8/gems/devise-2.0.4/app/views"
,但我這裏有一個視圖頁面:
app/views/layouts/mobile/application.html.haml
是否需要指定我在控制器中返回HAML格式的問題?或者我做錯了什麼?
我剛剛創建了該文件,但不幸的是它仍然給出了相同的錯誤。 – GeekedOut 2012-04-16 18:41:08
實際上,我在app/views/layouts/mobile/home中有我的index.html.haml文件,但是您說不要將它放到佈局文件夾中?怎麼來的? – GeekedOut 2012-04-16 18:44:24
由於它的工作方式....我只是想知道如果我放在佈局文件夾中的任何東西擺在首位。 – GeekedOut 2012-04-16 18:46:47