0

我正在学习 Ruby,我设置了一个这样的控制器:

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 格式的问题吗?还是我做错了什么?

4

1 回答 1

2

您的程序试图找到一个常规模板,而不是布局。尝试创建页面:

app/views/mobile/home/index.html.haml
于 2012-04-16T18:38:42.283 回答