2013-03-08 84 views
-3

如何解决这个错误红宝石“模板丢失”铁路 我控制器模板丢失轨

class SayController < ApplicationController 
    def hello 
    @title = "Ruby on Rails" 
    @website = "www.9lessons.info" 
    end 
end 

我的HTML页面

<html> 
    <head> 
    <title><%= @title %></title> 
    </head> 
    <body> 
    <h1>Welcome to <%= @website %></h1> 
    Addition : <%= 100 + 300 %> 
    </body> 
</html> 
+1

你能复制确切的错误吗?并说明您尝试访问的网址是什么? – jvnill 2013-03-08 14:10:32

回答

0

您的高清方法的名称需要匹配您的视图名称。

def index 
end 

必须index.html.erb

def hello 
end 

将hello.html.erb

def world 
end 

将world.html.erb

如果没有,你会得到一个缺失的模板因为它正在寻找那个特定的名字。