Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ruby-on-rails/63.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails 模板缺少rails_Ruby On Rails - Fatal编程技术网

Ruby on rails 模板缺少rails

Ruby on rails 模板缺少rails,ruby-on-rails,Ruby On Rails,如何解决RubyonRail中的“模板丢失”错误 我的控制器是 class SayController < ApplicationController def hello @title = "Ruby on Rails" @website = "www.9lessons.info" end end class-SayController

如何解决RubyonRail中的“模板丢失”错误 我的控制器是

class SayController < ApplicationController
  def hello
    @title = "Ruby on Rails"
    @website = "www.9lessons.info"
  end
end
class-SayController
我的html页面是

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

欢迎来到
补充:

您的def方法名称需要与视图名称匹配

i、 e

必须是index.html.erb

def hello
end 
应该是hello.html.erb

def world 
end 
将是world.html.erb


如果没有,您将得到一个丢失的模板,因为它正在寻找特定的名称。

您能复制准确的错误吗?并说明您试图访问的url?
def world 
end