Reputation: 17185
I am learning Ruby and I set up a controller like this:
class Mobile::HomeController < ApplicationController
def index
end
def create
end
end
Which is very basic, and added a route like this:
scope :module => :mobile, :as => :mobile do
constraints(:subdomain => /m/) do
resources :home
end
end
and when I try to see the page in the browser, I get this error:
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"
but I have a view page here:
app/views/layouts/mobile/application.html.haml
Is the problem that I need to specify that I return the HAML format in my controller? Or am I doing something wrong?
Upvotes: 0
Views: 2861
Reputation: 15771
Your program tries to find a regular template, not the layout. Try to create the page:
app/views/mobile/home/index.html.haml
Upvotes: 2