Ruby on rails 模板缺少rails
如何解决RubyonRail中的“模板丢失”错误 我的控制器是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
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