[英]Rails “Template is missing” error
I am beginner in Rails. 我是Rails的初学者。
In routes.rb
I have 在
routes.rb
我有
resources :posts
http://i.imgur.com/FlGROJC.png?1 http://i.imgur.com/FlGROJC.png?1
when I click to "Add a new post" for the empty title of the post,I get a error like 当我点击帖子的空标题“添加新帖子”时,我得到一个错误
Template is missing
Missing template posts/New, application/New with {:locale=>[:en], :formats=>[:html], :handlers=>[:erb, :builder, :raw, :ruby, :jbuilder, :coffee]}.
Searched in:
* "/home/dilip/blog/app/views"
* "/home/dilip/.rvm/gems/ruby-1.9.3-p448/gems/devise-3.0.0.rc/app/views"
Please Help! 请帮忙!
You have 你有
render "New"
in your controller. 在你的控制器中。 You should change it to:
您应该将其更改为:
render "new"
That means that Rails is looking for posts/new.html.erb
, and you don't have a posts/new.html.erb
file. 这意味着Rails正在寻找
posts/new.html.erb
,而你没有posts/new.html.erb
文件。 (Or haml file, or whatever templating language you're using. (或haml文件,或您正在使用的任何模板语言。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.